diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-05 18:56:22 +0300 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-09 18:10:41 +0300 |
commit | dd1a683c6411588141c262187d404899e5689521 (patch) | |
tree | 6d481eb221bdfab97c8d0230cd8770e56d92751b /app/assets/javascripts/projects_list.js.coffee | |
parent | 706b101f510b9a1f5acff51bb2f1b14c018b37ce (diff) |
Fix explore filter. Fixes #13182
Diffstat (limited to 'app/assets/javascripts/projects_list.js.coffee')
-rw-r--r-- | app/assets/javascripts/projects_list.js.coffee | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/app/assets/javascripts/projects_list.js.coffee b/app/assets/javascripts/projects_list.js.coffee index ebf7140b7e3..873495bfe72 100644 --- a/app/assets/javascripts/projects_list.js.coffee +++ b/app/assets/javascripts/projects_list.js.coffee @@ -1,24 +1,28 @@ class @ProjectsList constructor: -> + $("#project-filter-form-field").unbind() $(".projects-list .js-expand").on 'click', (e) -> e.preventDefault() list = $(this).closest('.projects-list') - list.find("li").show() - list.find("li.bottom").hide() - $(".projects-list-filter").keyup -> - terms = $(this).val() - uiBox = $('div.projects-list-holder') - filterSelector = $(this).data('filter-selector') || 'span.filter-title' + $("#filter_projects").keyup -> + ProjectsList.filter_results("#filter_projects") + $("#project-filter-form-field").keyup -> + ProjectsList.filter_results("#project-filter-form-field") - if terms == "" || terms == undefined - uiBox.find("ul.projects-list li").show() - else - uiBox.find("ul.projects-list li").each (index) -> - name = $(this).find(filterSelector).text() + @filter_results: (element) -> + terms = $(element).val() + filterSelector = $(element).data('filter-selector') || 'span.filter-title' - if name.toLowerCase().search(terms.toLowerCase()) == -1 - $(this).hide() - else - $(this).show() - uiBox.find("ul.projects-list li.bottom").hide() + if terms == "" || terms == undefined + $("ul.projects-list li").show() + $('.gl-pagination').show() + else + $("ul.projects-list li").each (index) -> + name = $(this).find(filterSelector).text() + + if name.toLowerCase().search(terms.toLowerCase()) == -1 + $(this).hide() + else + $(this).show() + $('.gl-pagination').hide() |