Commit a16533a04a3033772bdde2616ce812a3247e6fb5
1 parent
e37a043d
Exists in
master
and in
4 other branches
Add groups to search autocomplete. Use alphabetically scope for users order
Showing
6 changed files
with
8 additions
and
6 deletions
Show diff stats
app/controllers/admin/users_controller.rb
... | ... | @@ -3,7 +3,7 @@ class Admin::UsersController < AdminController |
3 | 3 | @admin_users = User.scoped |
4 | 4 | @admin_users = @admin_users.filter(params[:filter]) |
5 | 5 | @admin_users = @admin_users.search(params[:name]) if params[:name].present? |
6 | - @admin_users = @admin_users.order("name ASC").page(params[:page]) | |
6 | + @admin_users = @admin_users.alphabetically.page(params[:page]) | |
7 | 7 | end |
8 | 8 | |
9 | 9 | def show | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -78,7 +78,8 @@ module ApplicationHelper |
78 | 78 | end |
79 | 79 | |
80 | 80 | def search_autocomplete_source |
81 | - projects = current_user.projects.map{ |p| { label: p.name_with_namespace, url: project_path(p) } } | |
81 | + projects = current_user.authorized_projects.map { |p| { label: p.name_with_namespace, url: project_path(p) } } | |
82 | + groups = current_user.authorized_groups.map { |group| { label: "<group> #{group.name}", url: group_path(group) } } | |
82 | 83 | |
83 | 84 | default_nav = [ |
84 | 85 | { label: "My Profile", url: profile_path }, |
... | ... | @@ -113,7 +114,7 @@ module ApplicationHelper |
113 | 114 | ] |
114 | 115 | end |
115 | 116 | |
116 | - [projects, default_nav, project_nav, help_nav].flatten.to_json | |
117 | + [groups, projects, default_nav, project_nav, help_nav].flatten.to_json | |
117 | 118 | end |
118 | 119 | |
119 | 120 | def emoji_autocomplete_source | ... | ... |
app/models/user.rb
app/views/groups/_new_group_member.html.haml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | %h6 1. Choose people you want in the team |
6 | 6 | .clearfix |
7 | 7 | = f.label :user_ids, "People" |
8 | - .input= select_tag(:user_ids, options_from_collection_for_select(User.active.order('name ASC'), :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | |
8 | + .input= select_tag(:user_ids, options_from_collection_for_select(User.active.alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | |
9 | 9 | |
10 | 10 | %h6 2. Set access level for them |
11 | 11 | .clearfix | ... | ... |
app/views/groups/_new_member.html.haml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | %h6 1. Choose people you want in the team |
6 | 6 | .clearfix |
7 | 7 | = f.label :user_ids, "People" |
8 | - .input= select_tag(:user_ids, options_from_collection_for_select(User.not_in_project(@project).order('name').all, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | |
8 | + .input= select_tag(:user_ids, options_from_collection_for_select(User.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | |
9 | 9 | |
10 | 10 | %h6 2. Set access level for them |
11 | 11 | .clearfix | ... | ... |
app/views/team_members/_form.html.haml
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | %h6 1. Choose people you want in the team |
12 | 12 | .clearfix |
13 | 13 | = f.label :user_ids, "People" |
14 | - .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).all, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | |
14 | + .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | |
15 | 15 | |
16 | 16 | %h6 2. Set access level for them |
17 | 17 | .clearfix | ... | ... |