From 3232f547ac250096f0f4baefff1bc245be1455ac Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Fri, 12 Jul 2013 18:29:39 +0300
Subject: [PATCH] Add group button at Profile#groups page

---
 app/controllers/profiles/groups_controller.rb |  2 +-
 app/views/profiles/groups/index.html.haml     | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/app/controllers/profiles/groups_controller.rb b/app/controllers/profiles/groups_controller.rb
index ac635f61feb..793d2a32954 100644
--- a/app/controllers/profiles/groups_controller.rb
+++ b/app/controllers/profiles/groups_controller.rb
@@ -2,7 +2,7 @@ class Profiles::GroupsController < ApplicationController
   layout "profile"
 
   def index
-    @groups = current_user.authorized_groups.all
+    @groups = current_user.authorized_groups.page(params[:page]).per(20)
   end
 
   def leave
diff --git a/app/views/profiles/groups/index.html.haml b/app/views/profiles/groups/index.html.haml
index c07c0355b4b..892f42124aa 100644
--- a/app/views/profiles/groups/index.html.haml
+++ b/app/views/profiles/groups/index.html.haml
@@ -1,5 +1,12 @@
 .ui-box
-  %h5.title Groups
+  %h5.title
+    %strong Groups
+    (#{@groups.count})
+    - if current_user.can_create_group?
+      %span.pull-right
+        = link_to new_group_path, class: "btn btn-small btn-primary" do
+          %i.icon-plus
+          New Group
   %ul.well-list
     - @groups.each do |group|
       %li
@@ -15,3 +22,5 @@
 
         = link_to group, class: 'group-name' do
           = group.name
+
+= paginate @groups
-- 
GitLab