Commit af9d7fafa9089e51db60f43b60a4fedebe053843
1 parent
d41e404e
Exists in
spb-stable
and in
3 other branches
Adopt Group#members page for large groups (> 100 users)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
5 changed files
with
42 additions
and
12 deletions
Show diff stats
app/assets/stylesheets/application.scss
@@ -65,6 +65,7 @@ | @@ -65,6 +65,7 @@ | ||
65 | @import "sections/wall.scss"; | 65 | @import "sections/wall.scss"; |
66 | @import "sections/dashboard.scss"; | 66 | @import "sections/dashboard.scss"; |
67 | @import "sections/stat_graph.scss"; | 67 | @import "sections/stat_graph.scss"; |
68 | +@import "sections/groups.scss"; | ||
68 | 69 | ||
69 | /** | 70 | /** |
70 | * Code ighlight | 71 | * Code ighlight |
app/controllers/groups_controller.rb
@@ -63,7 +63,14 @@ class GroupsController < ApplicationController | @@ -63,7 +63,14 @@ class GroupsController < ApplicationController | ||
63 | 63 | ||
64 | def members | 64 | def members |
65 | @project = group.projects.find(params[:project_id]) if params[:project_id] | 65 | @project = group.projects.find(params[:project_id]) if params[:project_id] |
66 | - @members = group.users_groups.order('group_access DESC') | 66 | + @members = group.users_groups |
67 | + | ||
68 | + if params[:search].present? | ||
69 | + users = group.users.search(params[:search]) | ||
70 | + @members = @members.where(user_id: users) | ||
71 | + end | ||
72 | + | ||
73 | + @members = @members.order('group_access DESC').page(params[:page]).per(50) | ||
67 | @users_group = UsersGroup.new | 74 | @users_group = UsersGroup.new |
68 | end | 75 | end |
69 | 76 |
app/views/groups/_new_group_member.html.haml
1 | = form_for @users_group, url: group_users_groups_path(@group), html: { class: 'form-horizontal users-group-form' } do |f| | 1 | = form_for @users_group, url: group_users_groups_path(@group), html: { class: 'form-horizontal users-group-form' } do |f| |
2 | - %h4.append-bottom-20 | ||
3 | - New member(s) for | ||
4 | - %strong #{@group.name} | ||
5 | - group | ||
6 | - | ||
7 | - %p 1. Choose users you want in the group | ||
8 | .form-group | 2 | .form-group |
9 | = f.label :user_ids, "People", class: 'control-label' | 3 | = f.label :user_ids, "People", class: 'control-label' |
10 | .col-sm-10= users_select_tag(:user_ids, multiple: true, class: 'input-large') | 4 | .col-sm-10= users_select_tag(:user_ids, multiple: true, class: 'input-large') |
11 | 5 | ||
12 | - %p 2. Set access level for them | ||
13 | .form-group | 6 | .form-group |
14 | = f.label :group_access, "Group Access", class: 'control-label' | 7 | = f.label :group_access, "Group Access", class: 'control-label' |
15 | .col-sm-10= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select select2" | 8 | .col-sm-10= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select select2" |
app/views/groups/members.html.haml
@@ -6,14 +6,34 @@ | @@ -6,14 +6,34 @@ | ||
6 | %strong= link_to "here", help_permissions_path, class: "vlink" | 6 | %strong= link_to "here", help_permissions_path, class: "vlink" |
7 | 7 | ||
8 | %hr | 8 | %hr |
9 | -.ui-box | 9 | + |
10 | +.clearfix | ||
11 | + = form_tag members_group_path(@group), method: :get, class: 'form-inline member-search-form' do | ||
12 | + .form-group | ||
13 | + = search_field_tag :search, params[:search], { placeholder: 'Find member by name', class: 'form-control search-text-input input-mn-300' } | ||
14 | + = submit_tag 'Search', class: 'btn' | ||
15 | + | ||
16 | + - if current_user.can? :manage_group, @group | ||
17 | + .pull-right | ||
18 | + = link_to '#', class: 'btn btn-new js-toggle-visibility-link' do | ||
19 | + Add members | ||
20 | + %i.icon-chevron-down | ||
21 | + | ||
22 | + .js-toggle-visibility-container.hide.new-group-member-holder | ||
23 | + = render "new_group_member" | ||
24 | + | ||
25 | +.ui-box.prepend-top-20 | ||
10 | .title | 26 | .title |
11 | %strong #{@group.name} | 27 | %strong #{@group.name} |
12 | group members | 28 | group members |
13 | %small | 29 | %small |
14 | - (#{@members.count}) | 30 | + (#{@members.total_count}) |
15 | %ul.well-list | 31 | %ul.well-list |
16 | - @members.each do |member| | 32 | - @members.each do |member| |
17 | = render 'users_groups/users_group', member: member, show_controls: true | 33 | = render 'users_groups/users_group', member: member, show_controls: true |
18 | -- if current_user.can? :manage_group, @group | ||
19 | - = render "new_group_member" | 34 | += paginate @members, theme: 'gitlab' |
35 | + | ||
36 | +:coffeescript | ||
37 | + $('form.member-search-form').on 'submit', (event) -> | ||
38 | + event.preventDefault() | ||
39 | + Turbolinks.visit @.action + '?' + $(@).serialize() |