diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2d1c32ecb..1962b7d34 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -16,11 +16,8 @@ class ApplicationController < ActionController::Base end def set_friends_and_status - unless current_user.nil? - @group = :all - @groups = current_user.groups - @friends = current_user.friends - end + @groups = current_user.groups + @friends = current_user.friends end def count_requests diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b0b4eaea7..ce672ef8a 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -3,10 +3,7 @@ class GroupsController < ApplicationController def index @posts = current_user.visible_posts(:by_members_of => :all).paginate :page => params[:page], :order => 'created_at DESC' - @friends = current_user.friends - - @groups = current_user.groups.find_all_by_id(params[:group_ids]) if params[:group_ids] - @groups ||= current_user.groups + @group = :all end def create diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1e0f03001..d8b4a05aa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,7 +1,7 @@ module ApplicationHelper def current_group?(group) - @group == :all || @group.id == group.id + @group != :all && @group.id == group.id end def object_path(object) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 83594acad..ac3e31f20 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -60,7 +60,8 @@ .container #group %ul - %li= link_to "All Groups", root_url + %li{:class => ("selected" if @group == :all)} + = link_to "All Groups", root_url - for group in @groups %li{:class => ("selected" if current_group?(group))} = link_for_group group diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index 93fc5fe84..e6e8408b2 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -9,7 +9,7 @@ %ul.group_selector going to... - - for group in current_user.groups + - for group in @groups %li = check_box_tag("group_ids[]", group.id, current_group?(group) ) = group.name