DG RS; passing around params[:aspect]. querying in application controller for current aspect.
This commit is contained in:
parent
01b14a66e8
commit
a7c6e22e01
5 changed files with 13 additions and 9 deletions
|
|
@ -36,7 +36,12 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def set_friends_and_status
|
def set_friends_and_status
|
||||||
if current_user
|
if current_user
|
||||||
@aspect = :all
|
if params[:aspect] == 'all' || params[:aspect] == nil
|
||||||
|
@aspect = :all
|
||||||
|
else
|
||||||
|
@aspect = current_user.aspect_by_id( params[:aspect])
|
||||||
|
end
|
||||||
|
|
||||||
@aspects = current_user.aspects
|
@aspects = current_user.aspects
|
||||||
@friends = current_user.friends
|
@friends = current_user.friends
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ module ApplicationHelper
|
||||||
@aspect != :all && @aspect.id == aspect.id
|
@aspect != :all && @aspect.id == aspect.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def object_path(object)
|
def object_path(object, opts = {})
|
||||||
eval("#{object.class.to_s.underscore}_path(object)")
|
eval("#{object.class.to_s.underscore}_path(object, opts)")
|
||||||
end
|
end
|
||||||
|
|
||||||
def object_fields(object)
|
def object_fields(object)
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,16 @@
|
||||||
-#
|
-#
|
||||||
|
|
||||||
.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)
|
= link_to post.name, object_path(post, :aspect => params[: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))
|
= link_to(how_long_ago(post), object_path(post, :aspect => params[: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)
|
= link_to (image_tag photo.url(:thumb_large)), album_path(post, :aspect => params[:aspect])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
= content_for :page_title do
|
= content_for :page_title do
|
||||||
= link_to "◂ Home", aspects_path
|
= link_to "◂ Home", aspects_path, :aspect => params[:aspect]
|
||||||
|
|
||||||
- content_for :left_pane do
|
- content_for :left_pane do
|
||||||
= render "shared/aspect_friends"
|
= render "shared/aspect_friends"
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
= content_for :page_title do
|
= content_for :page_title do
|
||||||
= link_to "◂ Albums", albums_path
|
= link_to "◂ Albums", albums_path(:aspect => @aspect)
|
||||||
|
|
||||||
- content_for :left_pane do
|
- content_for :left_pane do
|
||||||
= render "shared/aspect_friends"
|
= render "shared/aspect_friends"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue