diff options
-rw-r--r-- | app/assets/javascripts/dashboard.js.coffee | 1 | ||||
-rw-r--r-- | app/assets/javascripts/projects_list.js.coffee | 36 | ||||
-rw-r--r-- | app/views/explore/projects/_filter.html.haml | 8 |
3 files changed, 21 insertions, 24 deletions
diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee index dd295088312..c2c28a50440 100644 --- a/app/assets/javascripts/dashboard.js.coffee +++ b/app/assets/javascripts/dashboard.js.coffee @@ -1,5 +1,6 @@ @Dashboard = init: -> + $("#project-filter-form-field").unbind() this.initSearch() initSearch: -> 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() diff --git a/app/views/explore/projects/_filter.html.haml b/app/views/explore/projects/_filter.html.haml index 66a4b535ae5..c248dbb695f 100644 --- a/app/views/explore/projects/_filter.html.haml +++ b/app/views/explore/projects/_filter.html.haml @@ -1,11 +1,3 @@ -.pull-left - = form_tag explore_projects_filter_path, method: :get, class: 'form-inline form-tiny' do |f| - .form-group - = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input", id: "projects_search", spellcheck: false - = hidden_field_tag :sort, @sort - .form-group - = button_tag 'Search', class: "btn" - .pull-right.hidden-sm.hidden-xs - if current_user .dropdown.inline.append-right-10 |