diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-25 19:17:17 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-26 14:50:52 -0500 |
commit | 4b720875a1a9a3a925398fdc669e42ed8ec8e62c (patch) | |
tree | 6db4d334839df0623e6feb62898578f9df5de947 /app/assets | |
parent | bf5a853e51a48a3113ccbba7cc8e62ca7999396f (diff) | |
download | gitlab-ce-4b720875a1a9a3a925398fdc669e42ed8ec8e62c.tar.gz |
Tidy up the code a bitcs-inline-js-search
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/search_autocomplete.js | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 6445a8018c2..9c59108f2ab 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -368,39 +368,38 @@ })(); $(function() { - if ($('.js-search-project-options').length) { - var projectOptionsDataEl = $('.js-search-project-options'); + var $projectOptionsDataEl = $('.js-search-project-options'); + var $groupOptionsDataEl = $('.js-search-group-options'); + var $dashboardOptionsDataEl = $('.js-search-dashboard-options'); + if ($projectOptionsDataEl.length) { gl.projectOptions = gl.projectOptions || {}; - var projectPath = projectOptionsDataEl.data('project-path'); + var projectPath = $projectOptionsDataEl.data('project-path'); gl.projectOptions[projectPath] = { - name: projectOptionsDataEl.data('name'), - issuesPath: projectOptionsDataEl.data('issues-path'), - mrPath: projectOptionsDataEl.data('mr-path') + 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'); - + + if ($groupOptionsDataEl.length) { gl.groupOptions = gl.groupOptions || {}; - var groupPath = groupOptionsDataEl.data('group-path'); + var groupPath = $groupOptionsDataEl.data('group-path'); gl.groupOptions[groupPath] = { - name: groupOptionsDataEl.data('name'), - issuesPath: groupOptionsDataEl.data('issues-path'), - mrPath: groupOptionsDataEl.data('mr-path') + 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'); + if ($dashboardOptionsDataEl.length) { gl.dashboardOptions = { - issuesPath: dashboardOptionsDataEl.data('issues-path'), - mrPath: dashboardOptionsDataEl.data('mr-path') + issuesPath: $dashboardOptionsDataEl.data('issues-path'), + mrPath: $dashboardOptionsDataEl.data('mr-path') }; } }); |