Commit bf17d976a7be3404e30a0211c4c9b5ef78bf5104
1 parent
163908b3
Exists in
master
and in
4 other branches
add api users filter and integrate users select2
Showing
7 changed files
with
28 additions
and
2 deletions
Show diff stats
app/assets/javascripts/application.js
@@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
17 | //= require bootstrap | 17 | //= require bootstrap |
18 | //= require modernizr | 18 | //= require modernizr |
19 | //= require chosen-jquery | 19 | //= require chosen-jquery |
20 | +//= require select2 | ||
20 | //= require raphael | 21 | //= require raphael |
21 | //= require g.raphael-min | 22 | //= require g.raphael-min |
22 | //= require g.bar-min | 23 | //= require g.bar-min |
app/assets/stylesheets/application.scss
app/assets/stylesheets/common.scss
@@ -554,3 +554,18 @@ img.emoji { | @@ -554,3 +554,18 @@ img.emoji { | ||
554 | .appear-data { | 554 | .appear-data { |
555 | display: none; | 555 | display: none; |
556 | } | 556 | } |
557 | + | ||
558 | +.ajax-users-select { | ||
559 | + width: 400px; | ||
560 | +} | ||
561 | + | ||
562 | +.user-result { | ||
563 | + .user-image { | ||
564 | + float: left; | ||
565 | + } | ||
566 | + .user-name { | ||
567 | + } | ||
568 | + .user-username { | ||
569 | + color: #999; | ||
570 | + } | ||
571 | +} |
app/controllers/application_controller.rb
@@ -152,5 +152,7 @@ class ApplicationController < ActionController::Base | @@ -152,5 +152,7 @@ class ApplicationController < ActionController::Base | ||
152 | 152 | ||
153 | def add_gon_variables | 153 | def add_gon_variables |
154 | gon.default_issues_tracker = Project.issues_tracker.default_value | 154 | gon.default_issues_tracker = Project.issues_tracker.default_value |
155 | + gon.api_token = current_user.private_token | ||
156 | + gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url | ||
155 | end | 157 | end |
156 | end | 158 | end |
app/helpers/application_helper.rb
@@ -169,4 +169,8 @@ module ApplicationHelper | @@ -169,4 +169,8 @@ module ApplicationHelper | ||
169 | end | 169 | end |
170 | 170 | ||
171 | alias_method :url_to_image, :image_url | 171 | alias_method :url_to_image, :image_url |
172 | + | ||
173 | + def users_select_tag(id) | ||
174 | + hidden_field_tag(id, '', class: "ajax-users-select") | ||
175 | + end | ||
172 | end | 176 | end |
app/views/team_members/_form.html.haml
@@ -11,7 +11,9 @@ | @@ -11,7 +11,9 @@ | ||
11 | %h6 1. Choose people you want in the team | 11 | %h6 1. Choose people you want in the team |
12 | .clearfix | 12 | .clearfix |
13 | = f.label :user_ids, "People" | 13 | = f.label :user_ids, "People" |
14 | - .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name_with_username), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | 14 | + .input |
15 | + = users_select_tag(:user_ids) | ||
16 | + -#= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name_with_username), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) | ||
15 | 17 | ||
16 | %h6 2. Set access level for them | 18 | %h6 2. Set access level for them |
17 | .clearfix | 19 | .clearfix |
lib/api/users.rb
@@ -9,7 +9,8 @@ module Gitlab | @@ -9,7 +9,8 @@ module Gitlab | ||
9 | # Example Request: | 9 | # Example Request: |
10 | # GET /users | 10 | # GET /users |
11 | get do | 11 | get do |
12 | - @users = paginate User | 12 | + @users = User.scoped |
13 | + @users = @users.search(params[:search]) if params[:search].present? | ||
13 | present @users, with: Entities::User | 14 | present @users, with: Entities::User |
14 | end | 15 | end |
15 | 16 |