From ce1b742b1e61d8726078e0060ba52aa8b9985c1b Mon Sep 17 00:00:00 2001 From: randx Date: Tue, 9 Oct 2012 09:46:20 +0300 Subject: [PATCH] Group: new link on dashboard if admin. Fixed people count --- app/controllers/groups_controller.rb | 2 +- app/roles/account.rb | 4 ++++ app/views/dashboard/_groups.html.haml | 5 +++++ app/views/groups/people.html.haml | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index c76e5c4..5576bc0 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -52,7 +52,7 @@ class GroupsController < ApplicationController end def people - @users = group.users + @users = group.users.all end protected diff --git a/app/roles/account.rb b/app/roles/account.rb index b8c445a..af5b7c8 100644 --- a/app/roles/account.rb +++ b/app/roles/account.rb @@ -22,6 +22,10 @@ module Account projects_limit > my_own_projects.count end + def can_create_group? + is_admin? + end + def last_activity_project projects.first end diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml index 146a49e..7c5e9f3 100644 --- a/app/views/dashboard/_groups.html.haml +++ b/app/views/dashboard/_groups.html.haml @@ -3,6 +3,11 @@ Groups %small (#{groups.count}) + - if current_user.can_create_group? + %span.right + = link_to new_admin_group_path, class: "btn very_small info" do + %i.icon-plus + New Group %ul.unstyled - groups.each do |group| %li.wll diff --git a/app/views/groups/people.html.haml b/app/views/groups/people.html.haml index 4c1865a..2581080 100644 --- a/app/views/groups/people.html.haml +++ b/app/views/groups/people.html.haml @@ -2,7 +2,7 @@ %h5 People %small - (#{@users.count}) + (#{@users.size}) %ul.unstyled - @users.each do |user| %li.wll -- libgit2 0.21.2