Finish select2-ajax for users. Added Select2Helper for tests
This commit is contained in:
parent
10f14136f5
commit
ef05423f47
11 changed files with 256 additions and 222 deletions
|
@ -19,7 +19,7 @@ $ ->
|
|||
multiple: $('.ajax-users-select').hasClass('multiselect')
|
||||
minimumInputLength: 0
|
||||
ajax: # instead of writing the function to execute the request we use Select2's convenient helper
|
||||
url: "/api/v3/users.json"
|
||||
url: "/api/" + gon.api_version + "/users.json"
|
||||
dataType: "json"
|
||||
data: (term, page) ->
|
||||
search: term # search term
|
||||
|
@ -33,11 +33,11 @@ $ ->
|
|||
initSelection: (element, callback) ->
|
||||
id = $(element).val()
|
||||
if id isnt ""
|
||||
$.ajax("http://api.rottentomatoes.com/api/public/v1.0/users/" + id + ".json",
|
||||
$.ajax(
|
||||
"/api/" + gon.api_version + "/users/" + id + ".json",
|
||||
dataType: "json"
|
||||
data:
|
||||
apikey: "ju6z9mjyajq2djue3gbvv26t"
|
||||
|
||||
dataType: "jsonp"
|
||||
private_token: gon.api_token
|
||||
).done (data) ->
|
||||
callback data
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
@import "gitlab_bootstrap.scss";
|
||||
|
||||
@import "common.scss";
|
||||
@import "ref_select.scss";
|
||||
@import "selects.scss";
|
||||
|
||||
@import "sections/header.scss";
|
||||
@import "sections/nav.scss";
|
||||
|
|
|
@ -555,17 +555,3 @@ img.emoji {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.ajax-users-select {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.user-result {
|
||||
.user-image {
|
||||
float: left;
|
||||
}
|
||||
.user-name {
|
||||
}
|
||||
.user-username {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
.ajax-users-select {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.user-result {
|
||||
.user-image {
|
||||
float: left;
|
||||
}
|
||||
.user-name {
|
||||
}
|
||||
.user-username {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.select2-no-results {
|
||||
padding: 7px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/** Branch/tag selector **/
|
||||
.project-refs-form {
|
||||
margin: 0;
|
|
@ -152,9 +152,8 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def add_gon_variables
|
||||
gon.default_issues_tracker = Project.issues_tracker.default_value
|
||||
if current_user
|
||||
gon.api_token = current_user.private_token
|
||||
gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
|
||||
end
|
||||
gon.api_version = Gitlab::API.version
|
||||
gon.api_token = current_user.private_token if current_user
|
||||
gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue