aspect filters shown selected on photo and statusmessage show pages

This commit is contained in:
danielvincent 2011-01-05 18:52:06 -08:00
parent 8c82a5974a
commit e1b6f4f074
6 changed files with 10 additions and 17 deletions

View file

@ -15,6 +15,7 @@ class ApplicationController < ActionController::Base
def set_contacts_notifications_and_status
if user_signed_in?
@aspect = nil
@object_aspect_ids = []
@all_aspects = current_user.aspects.fields(:name)
@aspects_dropdown_array = @all_aspects.collect{|x| [x.to_s, x.id]}
@notification_count = Notification.for(current_user, :unread =>true).all.count

View file

@ -147,6 +147,8 @@ class PhotosController < ApplicationController
@parent = @photo
end
@object_aspect_ids = @parent.aspects.map{|a| a.id}
comments_hash = Comment.hash_from_post_ids [@parent.id]
person_hash = Person.from_post_comment_hash comments_hash
@comment_hashes = comments_hash[@parent.id].map do |comment|

View file

@ -78,6 +78,9 @@ class StatusMessagesController < ApplicationController
:person => person_hash[comment.person_id]
}
end
@object_aspect_ids = @status_message.aspects.map{|a| a.id}
respond_with @status_message
end
end

View file

@ -45,7 +45,7 @@
= link_to t('_home'), root_path, :class => 'home_selector'
- for aspect in @all_aspects
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if current_aspect?(aspect))}
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if @object_aspect_ids.include?(aspect.id))}
= link_for_aspect(aspect, :class => 'aspect_selector')
= link_to '▼', edit_aspect_path(aspect), :class => 'aspect_selector_edit'

View file

@ -4,15 +4,6 @@
%h4
= person.name
- if post.public?
%span.arrow ➔
%span.aspect_badge.public
=t('the_world')
- elsif current_user.owns?(post)
%span.arrow ➔
=aspect_badge(aspects_with_post(post.aspects, post))
#person_nav_links
= link_to t('layouts.header.view_profile'), person_path(person)
= link_to t('_photos'), person_photos_path(person)

View file

@ -1998,9 +1998,6 @@ h3,h4
:font
:weight normal
&:hover
:color #eee
.aspects
:position relative
:margin
@ -2025,10 +2022,9 @@ h3,h4
.aspect_badge.single
:background
:color #999
.aspect_badge.all
&:hover
:background
:color #ccc
:color #bbb
.stream
.avatar