From aa5447f55303df54a5bf121e9fe0c813d3106a12 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Mon, 13 Sep 2010 18:08:33 -0700 Subject: [PATCH] Albums are now created within a context --- app/controllers/albums_controller.rb | 1 + app/views/albums/_new_album.haml | 2 +- app/views/albums/index.html.haml | 8 ++----- app/views/aspects/new.html.haml | 33 ---------------------------- app/views/aspects/show.html.haml | 2 +- 5 files changed, 5 insertions(+), 41 deletions(-) delete mode 100644 app/views/aspects/new.html.haml diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 6656a7cef..02eb7a403 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -24,6 +24,7 @@ class AlbumsController < ApplicationController respond_to :json, :only => [:index, :show] def index + @aspect = current_user.aspect_by_id( params[:aspect] ) unless params[:aspect] == 'all' @albums = current_user.albums_by_aspect(@aspect).paginate respond_with @albums end diff --git a/app/views/albums/_new_album.haml b/app/views/albums/_new_album.haml index 743bae2fd..20fac83f0 100644 --- a/app/views/albums/_new_album.haml +++ b/app/views/albums/_new_album.haml @@ -24,5 +24,5 @@ %p = f.label :name = f.text_field :name - = f.hidden_field :to, :value => :all + = f.hidden_field :to, :value => aspect = f.submit 'create', :class => 'button' diff --git a/app/views/albums/index.html.haml b/app/views/albums/index.html.haml index 1cd9b8a89..7e93b5a80 100644 --- a/app/views/albums/index.html.haml +++ b/app/views/albums/index.html.haml @@ -30,16 +30,12 @@ = render "shared/aspect_friends" - content_for :publish do + %br = link_to 'New Album', '#new_album_pane', {:class => "button", :id => "add_album_button"} .yo{:style => "display:none;" } #new_album_pane - = render "albums/new_album" - -.sub_header - %ul.button_set - %li{:class => ("selected" if params[:friends])}= friends_albums_link - %li{:class => ("selected" if not params[:friends])}= your_albums_link + = render "albums/new_album", :aspect => params[:aspect] %div - for album in @albums diff --git a/app/views/aspects/new.html.haml b/app/views/aspects/new.html.haml deleted file mode 100644 index 67ce736a0..000000000 --- a/app/views/aspects/new.html.haml +++ /dev/null @@ -1,33 +0,0 @@ --# Copyright 2010 Diaspora Inc. --# --# This file is part of Diaspora. --# --# Diaspora is free software: you can redistribute it and/or modify --# it under the terms of the GNU Affero General Public License as published by --# the Free Software Foundation, either version 3 of the License, or --# (at your option) any later version. --# --# Diaspora is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU Affero General Public License for more details. --# --# You should have received a copy of the GNU Affero General Public License --# along with Diaspora. If not, see . --# - - -%h1.big_text - =link_to 'aspects', aspects_path - >> - new aspect - -= form_for @aspect do |f| - = f.error_messages - %p - = f.label :name - = f.text_field :name - %p - = f.submit - -%p= link_to "Back to List", aspects_path diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index ed65d936e..43abfb6f2 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -18,7 +18,7 @@ - content_for :page_title do - = link_to "photos", albums_path + = link_to "photos", albums_path(:aspect => @aspect) - content_for :left_pane do = render "shared/aspect_friends"