diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-05 21:51:17 +0300 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-09 18:10:41 +0300 |
commit | 0dc64a8ce1e9bde993ea7a862c71d7edaa69a286 (patch) | |
tree | 73423833ace11243b3392f0d894cd3c4334bc9f9 /app/assets/javascripts/projects_list.js.coffee | |
parent | dd1a683c6411588141c262187d404899e5689521 (diff) |
JS Fixes
Diffstat (limited to 'app/assets/javascripts/projects_list.js.coffee')
-rw-r--r-- | app/assets/javascripts/projects_list.js.coffee | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/app/assets/javascripts/projects_list.js.coffee b/app/assets/javascripts/projects_list.js.coffee index 873495bfe72..b4f5546a42f 100644 --- a/app/assets/javascripts/projects_list.js.coffee +++ b/app/assets/javascripts/projects_list.js.coffee @@ -1,28 +1,29 @@ class @ProjectsList constructor: -> - $("#project-filter-form-field").unbind() + $("#project-filter-form-field").off('keyup') $(".projects-list .js-expand").on 'click', (e) -> e.preventDefault() list = $(this).closest('.projects-list') - $("#filter_projects").keyup -> - ProjectsList.filter_results("#filter_projects") - $("#project-filter-form-field").keyup -> - ProjectsList.filter_results("#project-filter-form-field") + $("#filter_projects").on 'keyup', -> + ProjectsList.filter_results($("#filter_projects")) + $("#project-filter-form-field").on 'keyup', -> + ProjectsList.filter_results($("#project-filter-form-field")) - @filter_results: (element) -> - terms = $(element).val() - filterSelector = $(element).data('filter-selector') || 'span.filter-title' + @filter_results: ($element) -> + terms = $($element).val() + filterSelector = $($element).data('filter-selector') || 'span.filter-title' - if terms == "" || terms == undefined + if not terms $("ul.projects-list li").show() $('.gl-pagination').show() else $("ul.projects-list li").each (index) -> - name = $(this).find(filterSelector).text() + $this = $(this) + name = $this.find(filterSelector).text() - if name.toLowerCase().search(terms.toLowerCase()) == -1 - $(this).hide() + if name.toLowerCase().indexOf(terms.toLowerCase()) == -1 + $this.hide() else - $(this).show() + $this.show() $('.gl-pagination').hide() |