Commit 3232f547ac250096f0f4baefff1bc245be1455ac
1 parent
acb402a1
Exists in
master
and in
4 other branches
Add group button at Profile#groups page
Showing
2 changed files
with
11 additions
and
2 deletions
Show diff stats
app/controllers/profiles/groups_controller.rb
@@ -2,7 +2,7 @@ class Profiles::GroupsController < ApplicationController | @@ -2,7 +2,7 @@ class Profiles::GroupsController < ApplicationController | ||
2 | layout "profile" | 2 | layout "profile" |
3 | 3 | ||
4 | def index | 4 | def index |
5 | - @groups = current_user.authorized_groups.all | 5 | + @groups = current_user.authorized_groups.page(params[:page]).per(20) |
6 | end | 6 | end |
7 | 7 | ||
8 | def leave | 8 | def leave |
app/views/profiles/groups/index.html.haml
1 | .ui-box | 1 | .ui-box |
2 | - %h5.title Groups | 2 | + %h5.title |
3 | + %strong Groups | ||
4 | + (#{@groups.count}) | ||
5 | + - if current_user.can_create_group? | ||
6 | + %span.pull-right | ||
7 | + = link_to new_group_path, class: "btn btn-small btn-primary" do | ||
8 | + %i.icon-plus | ||
9 | + New Group | ||
3 | %ul.well-list | 10 | %ul.well-list |
4 | - @groups.each do |group| | 11 | - @groups.each do |group| |
5 | %li | 12 | %li |
@@ -15,3 +22,5 @@ | @@ -15,3 +22,5 @@ | ||
15 | 22 | ||
16 | = link_to group, class: 'group-name' do | 23 | = link_to group, class: 'group-name' do |
17 | = group.name | 24 | = group.name |
25 | + | ||
26 | += paginate @groups |