Tabs on the top aren't all selected on group select, some other view tweaks

This commit is contained in:
Raphael 2010-08-24 19:22:43 -07:00
parent d3c10f8777
commit 5ac5f58679
5 changed files with 7 additions and 12 deletions

View file

@ -16,12 +16,9 @@ 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
end
def count_requests
@request_count = Request.for_user(current_user).size if current_user

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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