mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-21 18:46:10 +10:00
Group#ldap_cn selectbox with ajax autocomplete via api
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
users_path: "/api/:version/users.json"
|
||||
user_path: "/api/:version/users/:id.json"
|
||||
notes_path: "/api/:version/projects/:id/notes.json"
|
||||
ldap_groups_path: "/api/:version/ldap/groups.json"
|
||||
|
||||
# Get 20 (depends on api) recent notes
|
||||
# Get 20 (depends on api) recent notes
|
||||
# and sort the ascending from oldest to newest
|
||||
notes: (project_id, callback) ->
|
||||
url = Api.buildUrl(Api.notes_path)
|
||||
url = url.replace(':id', project_id)
|
||||
|
||||
|
||||
$.ajax(
|
||||
url: url,
|
||||
data:
|
||||
@@ -37,7 +38,7 @@
|
||||
# Only active users retrieved
|
||||
users: (query, callback) ->
|
||||
url = Api.buildUrl(Api.users_path)
|
||||
|
||||
|
||||
$.ajax(
|
||||
url: url
|
||||
data:
|
||||
@@ -52,3 +53,18 @@
|
||||
buildUrl: (url) ->
|
||||
url = gon.relative_url_root + url if gon.relative_url_root?
|
||||
return url.replace(':version', gon.api_version)
|
||||
|
||||
# Return LDAP groups list. Filtered by query
|
||||
ldap_groups: (query, callback) ->
|
||||
url = Api.buildUrl(Api.ldap_groups_path)
|
||||
|
||||
$.ajax(
|
||||
url: url
|
||||
data:
|
||||
private_token: gon.api_token
|
||||
search: query
|
||||
per_page: 20
|
||||
active: true
|
||||
dataType: "json"
|
||||
).done (groups) ->
|
||||
callback(groups)
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
= f.label :ldap_cn do
|
||||
LDAP Group cn
|
||||
.controls
|
||||
= f.text_field :ldap_cn, placeholder: "Ex. QA group", class: "xxlarge left"
|
||||
= f.hidden_field :ldap_cn, placeholder: "Ex. QA group", class: "xxlarge ajax-ldap-groups-select"
|
||||
|
||||
.control-group
|
||||
= f.label :ldap_access do
|
||||
|
||||
Reference in New Issue
Block a user