diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-07-15 20:04:53 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-26 22:50:52 +0300 |
commit | 909d2d8b3144f5b25652547758aa237474e5b4a2 (patch) | |
tree | 76e6cdf36f04c2b4a02aa27bfaa85ad75b5eb9c1 /app/assets/javascripts/search_autocomplete.js | |
parent | af3cc3837856e86815cb1d774b831fa7abaa8795 (diff) |
Remove inline JavaScript for Search autocomplete.
Diffstat (limited to 'app/assets/javascripts/search_autocomplete.js')
-rw-r--r-- | app/assets/javascripts/search_autocomplete.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 227e8c696b4..6445a8018c2 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -367,4 +367,42 @@ })(); + $(function() { + if ($('.js-search-project-options').length) { + var projectOptionsDataEl = $('.js-search-project-options'); + + gl.projectOptions = gl.projectOptions || {}; + + var projectPath = projectOptionsDataEl.data('project-path'); + + gl.projectOptions[projectPath] = { + name: projectOptionsDataEl.data('name'), + issuesPath: projectOptionsDataEl.data('issues-path'), + mrPath: projectOptionsDataEl.data('mr-path') + }; + } + + if ($('.js-search-group-options').length) { + var groupOptionsDataEl = $('.js-search-group-options'); + + gl.groupOptions = gl.groupOptions || {}; + + var groupPath = groupOptionsDataEl.data('group-path'); + + gl.groupOptions[groupPath] = { + name: groupOptionsDataEl.data('name'), + issuesPath: groupOptionsDataEl.data('issues-path'), + mrPath: groupOptionsDataEl.data('mr-path') + }; + } + + if ($('.js-search-dashboard-options').length) { + var dashboardOptionsDataEl = $('.js-search-dashboard-options'); + gl.dashboardOptions = { + issuesPath: dashboardOptionsDataEl.data('issues-path'), + mrPath: dashboardOptionsDataEl.data('mr-path') + }; + } + }); + }).call(this); |