BigW Consortium Gitlab

Commit dd1a683c by Josh Frye

Fix explore filter. Fixes #13182

parent 706b101f
@Dashboard =
init: ->
$("#project-filter-form-field").unbind()
this.initSearch()
initSearch: ->
......
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()
.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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment