From 24cd518f11fc7e82894315c9073ea606a1b48db9 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi <Dan@SPEEDRACER.local> Date: Tue, 14 Sep 2010 11:00:16 -0700 Subject: [PATCH] DG, RS; Album creation no longer ejects you from context --- app/controllers/albums_controller.rb | 6 +++--- app/controllers/application_controller.rb | 2 +- app/views/albums/_album.html.haml | 6 +++--- app/views/aspects/manage.html.haml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 02eb7a4031..671d593c99 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -24,15 +24,15 @@ 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 + respond_with @albums, :aspect => @aspect end def create + aspect = params[:album][:to] @album = current_user.post(:album, params[:album]) flash[:notice] = "You've created an album called #{@album.name}." - respond_with @album + redirect_to :action => :show, :id => @album.id, :aspect => aspect end def new diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d747a219cb..2eec8cf236 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -36,7 +36,7 @@ class ApplicationController < ActionController::Base def set_friends_and_status if current_user - if params[:aspect] == 'all' || params[:aspect] == nil + if params[:aspect] == nil || params[:aspect] == 'all' @aspect = :all else @aspect = current_user.aspect_by_id( params[:aspect]) diff --git a/app/views/albums/_album.html.haml b/app/views/albums/_album.html.haml index 9e0585781c..b92611f6f5 100644 --- a/app/views/albums/_album.html.haml +++ b/app/views/albums/_album.html.haml @@ -18,15 +18,15 @@ .album{:id => post.id, :class => ("mine" if current_user.owns?(post))} %div.name - = link_to post.name, object_path(post, :aspect => params[:aspect]) + = link_to post.name, object_path(post, :aspect => @aspect) %div.time by = link_to ((current_user.person == post.person)? 'you' : post.person.real_name), person_path(post.person) %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 - 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) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index fda97275aa..a4a3635137 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -39,7 +39,7 @@ %ul - 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") -- GitLab