add api users filter and integrate users select2

This commit is contained in:
Dmitriy Zaporozhets 2013-03-13 21:37:50 +02:00
parent 163908b393
commit bf17d976a7
7 changed files with 28 additions and 2 deletions

View file

@ -17,6 +17,7 @@
//= require bootstrap //= require bootstrap
//= require modernizr //= require modernizr
//= require chosen-jquery //= require chosen-jquery
//= require select2
//= require raphael //= require raphael
//= require g.raphael-min //= require g.raphael-min
//= require g.bar-min //= require g.bar-min

View file

@ -5,6 +5,7 @@
*= require jquery.ui.gitlab *= require jquery.ui.gitlab
*= require jquery.atwho *= require jquery.atwho
*= require chosen *= require chosen
*= require select2
*= require_self *= require_self
*/ */

View file

@ -554,3 +554,18 @@ img.emoji {
.appear-data { .appear-data {
display: none; display: none;
} }
.ajax-users-select {
width: 400px;
}
.user-result {
.user-image {
float: left;
}
.user-name {
}
.user-username {
color: #999;
}
}

View file

@ -152,5 +152,7 @@ class ApplicationController < ActionController::Base
def add_gon_variables def add_gon_variables
gon.default_issues_tracker = Project.issues_tracker.default_value gon.default_issues_tracker = Project.issues_tracker.default_value
gon.api_token = current_user.private_token
gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
end end
end end

View file

@ -169,4 +169,8 @@ module ApplicationHelper
end end
alias_method :url_to_image, :image_url alias_method :url_to_image, :image_url
def users_select_tag(id)
hidden_field_tag(id, '', class: "ajax-users-select")
end
end end

View file

@ -11,7 +11,9 @@
%h6 1. Choose people you want in the team %h6 1. Choose people you want in the team
.clearfix .clearfix
= f.label :user_ids, "People" = f.label :user_ids, "People"
.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}) .input
= users_select_tag(:user_ids)
-#= 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})
%h6 2. Set access level for them %h6 2. Set access level for them
.clearfix .clearfix

View file

@ -9,7 +9,8 @@ module Gitlab
# Example Request: # Example Request:
# GET /users # GET /users
get do get do
@users = paginate User @users = User.scoped
@users = @users.search(params[:search]) if params[:search].present?
present @users, with: Entities::User present @users, with: Entities::User
end end