summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-04-15 15:12:04 +0100
committerPhil Hughes <me@iamphill.com>2016-04-26 09:03:04 +0100
commitbb50edb16d426fad1544f08cae7d2dbe41152e26 (patch)
treeaa24ffda7c7cc03d8f1a8bab4d306cfa3eeda75d /app/assets
parentb3af3930c6c9a635cf21192c2d5a50dc51a9f5da (diff)
downloadgitlab-ce-bb50edb16d426fad1544f08cae7d2dbe41152e26.tar.gz
Loads group & projects on search page with ajax
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/search_dropdowns.js.coffee38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/assets/javascripts/search_dropdowns.js.coffee b/app/assets/javascripts/search_dropdowns.js.coffee
index 37c5c94d8b0..747483d1d8b 100644
--- a/app/assets/javascripts/search_dropdowns.js.coffee
+++ b/app/assets/javascripts/search_dropdowns.js.coffee
@@ -3,4 +3,42 @@ class @SearchDropdowns
$('.js-search-group-dropdown').glDropdown(
selectable: true
filterable: true
+ fieldName: 'group_id'
+ data: (term, callback) ->
+ Api.groups term, null, (data) ->
+ data.unshift(
+ name: 'Any'
+ )
+ data.splice 1, 0, 'divider'
+
+ callback(data)
+ id: (obj) ->
+ obj.id
+ text: (obj) ->
+ obj.name
+ clicked: =>
+ @submitSearch()
)
+
+ $('.js-search-project-dropdown').glDropdown(
+ selectable: true
+ filterable: true
+ fieldName: 'project_id'
+ data: (term, callback) ->
+ Api.projects term, 'id', (data) ->
+ data.unshift(
+ name_with_namespace: 'Any'
+ )
+ data.splice 1, 0, 'divider'
+
+ callback(data)
+ id: (obj) ->
+ obj.id
+ text: (obj) ->
+ obj.name_with_namespace
+ clicked: =>
+ @submitSearch()
+ )
+
+ submitSearch: ->
+ $('.js-search-form').submit()