Revert "header data as helper methods"

This reverts commit 607013bc83.
This commit is contained in:
Maxwell Salzberg 2011-09-30 14:43:52 -07:00
parent 5348c72209
commit 63c7634f6a
2 changed files with 21 additions and 26 deletions

View file

@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
inflection_method :grammatical_gender => :gender inflection_method :grammatical_gender => :gender
helper_method :all_aspects, :all_contacts_count, :my_contacts_count, :only_sharing_count, :notification_count, :unread_message_count helper_method :all_aspects, :all_contacts_count, :my_contacts_count, :only_sharing_count
helper_method :tags, :tag_followings helper_method :tags, :tag_followings
def ensure_http_referer_is_set def ensure_http_referer_is_set
@ -26,6 +26,8 @@ class ApplicationController < ActionController::Base
if user_signed_in? if user_signed_in?
if request.format.html? && !params[:only_posts] if request.format.html? && !params[:only_posts]
@aspect = nil @aspect = nil
@notification_count = Notification.for(current_user, :unread =>true).count
@unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
end end
end end
end end
@ -42,14 +44,6 @@ class ApplicationController < ActionController::Base
end end
##helpers ##helpers
def notification_count
@ontification_count ||= Notification.for(current_user, :unread =>true).count
end
def unread_message_count
@unread_message_count ||= ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
end
def all_aspects def all_aspects
@all_aspects ||= current_user.aspects @all_aspects ||= current_user.aspects
end end

View file

@ -21,6 +21,7 @@
= form_tag(people_path, :method => 'get', :class => "search_form") do = form_tag(people_path, :method => 'get', :class => "search_form") do
= text_field_tag 'q', nil, :placeholder => t('find_people'), :type => 'search', :results => 5 = text_field_tag 'q', nil, :placeholder => t('find_people'), :type => 'search', :results => 5
- if @notification_count
#nav_badges #nav_badges
#home_badge.badge #home_badge.badge
= link_to aspects_path, :title => t('_home') do = link_to aspects_path, :title => t('_home') do
@ -33,14 +34,14 @@
#notification_badge.badge #notification_badge.badge
= link_to notifications_path, :title => new_notification_text(@notification_count) do = link_to notifications_path, :title => new_notification_text(@notification_count) do
= image_tag 'icons/notifications_grey.svg', :height => 16, :id => "notification-flag" = image_tag 'icons/notifications_grey.svg', :height => 16, :id => "notification-flag"
.badge_count{:class => ("hidden" if notification_count == 0)} .badge_count{:class => ("hidden" if @notification_count == 0)}
= notification_count = @notification_count
#message_inbox_badge.badge #message_inbox_badge.badge
= link_to conversations_path , :title => new_message_text(@unread_message_count) do = link_to conversations_path , :title => new_message_text(@unread_message_count) do
= image_tag 'icons/mail_grey.svg', :width => 18 = image_tag 'icons/mail_grey.svg', :width => 18
.badge_count{:class => ("hidden" if unread_message_count == 0)} .badge_count{:class => ("hidden" if @unread_message_count == 0)}
= unread_message_count = @unread_message_count
#notification_dropdown #notification_dropdown
.header .header