Commit f8137075d5a615e968a4b63af13e1c51c36153df

Authored by Dmitriy Zaporozhets
1 parent 0b747a0f

Show correct group membership in profile

app/controllers/profiles/groups_controller.rb
... ... @@ -2,7 +2,7 @@ class Profiles::GroupsController < ApplicationController
2 2 layout "profile"
3 3  
4 4 def index
5   - @groups = current_user.authorized_groups.page(params[:page]).per(20)
  5 + @user_groups = current_user.users_groups.page(params[:page]).per(20)
6 6 end
7 7  
8 8 def leave
... ...
app/views/profiles/groups/index.html.haml
... ... @@ -11,9 +11,10 @@
11 11 .ui-box
12 12 .title
13 13 %strong Groups
14   - (#{@groups.count})
  14 + (#{@user_groups.count})
15 15 %ul.well-list
16   - - @groups.each do |group|
  16 + - @user_groups.each do |user_group|
  17 + - group = user_group.group
17 18 %li
18 19 .pull-right
19 20 - if can?(current_user, :manage_group, group)
... ... @@ -28,4 +29,7 @@
28 29 = link_to group, class: 'group-name' do
29 30 = group.name
30 31  
31   -= paginate @groups
  32 + as #{user_group.human_access}
  33 +
  34 +
  35 += paginate @user_groups
... ...