DG, RS; Album creation no longer ejects you from context

This commit is contained in:
Daniel Vincent Grippi 2010-09-14 11:00:16 -07:00
parent da8ec589b7
commit 24cd518f11
4 changed files with 8 additions and 8 deletions

View file

@ -24,15 +24,15 @@ class AlbumsController < ApplicationController
respond_to :json, :only => [:index, :show] respond_to :json, :only => [:index, :show]
def index def index
@aspect = current_user.aspect_by_id( params[:aspect] ) unless params[:aspect] == 'all'
@albums = current_user.albums_by_aspect(@aspect).paginate @albums = current_user.albums_by_aspect(@aspect).paginate
respond_with @albums respond_with @albums, :aspect => @aspect
end end
def create def create
aspect = params[:album][:to]
@album = current_user.post(:album, params[:album]) @album = current_user.post(:album, params[:album])
flash[:notice] = "You've created an album called #{@album.name}." flash[:notice] = "You've created an album called #{@album.name}."
respond_with @album redirect_to :action => :show, :id => @album.id, :aspect => aspect
end end
def new def new

View file

@ -36,7 +36,7 @@ class ApplicationController < ActionController::Base
def set_friends_and_status def set_friends_and_status
if current_user if current_user
if params[:aspect] == 'all' || params[:aspect] == nil if params[:aspect] == nil || params[:aspect] == 'all'
@aspect = :all @aspect = :all
else else
@aspect = current_user.aspect_by_id( params[:aspect]) @aspect = current_user.aspect_by_id( params[:aspect])

View file

@ -18,15 +18,15 @@
.album{:id => post.id, :class => ("mine" if current_user.owns?(post))} .album{:id => post.id, :class => ("mine" if current_user.owns?(post))}
%div.name %div.name
= link_to post.name, object_path(post, :aspect => params[:aspect]) = link_to post.name, object_path(post, :aspect => @aspect)
%div.time %div.time
by by
= link_to ((current_user.person == post.person)? 'you' : post.person.real_name), person_path(post.person) = link_to ((current_user.person == post.person)? 'you' : post.person.real_name), person_path(post.person)
%br %br
= link_to(how_long_ago(post), object_path(post, :aspect => params[:aspect])) = link_to(how_long_ago(post), object_path(post, :aspect => @aspect))
%div.image_cycle %div.image_cycle
- for photo in post.photos[0..3] - for photo in post.photos[0..3]
= link_to (image_tag photo.url(:thumb_large)), album_path(post, :aspect => params[:aspect]) = link_to (image_tag photo.url(:thumb_large)), album_path(post, :aspect => @aspect)

View file

@ -39,7 +39,7 @@
%ul %ul
- content_for :publish do - content_for :publish do
.new_aspect= link_to("add a new aspect", "#add_aspect_pane", :id => "add_aspect_button", :title => "Add a new relation") = link_to("add a new aspect", "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => "Add a new aspect")