diff options
author | Phil Hughes <me@iamphill.com> | 2016-04-15 15:12:04 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-04-26 09:03:04 +0100 |
commit | bb50edb16d426fad1544f08cae7d2dbe41152e26 (patch) | |
tree | aa24ffda7c7cc03d8f1a8bab4d306cfa3eeda75d /app/assets | |
parent | b3af3930c6c9a635cf21192c2d5a50dc51a9f5da (diff) | |
download | gitlab-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.coffee | 38 |
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() |