Commit 2c871ca1 authored by Josh Frye's avatar Josh Frye

Delay filter until user stops typing

parent 7522ac0b
class @Dashboard
constructor: ->
new ProjectsList()
ProjectsList.init()
......@@ -45,7 +45,7 @@
filterResults: =>
form = $("#issue_search_form")
search = $("#issue_search").val()
search = $("#projects-list-filter").val()
$('.issues-holder').css("opacity", '0.5')
issues_url = form.attr('action') + '?' + form.serialize()
......
class @ProjectsList
constructor: ->
@ProjectsList =
init: ->
$(".projects-list .js-expand").on 'click', (e) ->
e.preventDefault()
list = $(this).closest('.projects-list')
list.find("li").show()
list.find("li.bottom").hide()
this.initSearch()
$(".projects-list-filter").keyup ->
terms = $(this).val()
initSearch: ->
@timer = null
$("#projects-list-filter").keyup ->
clearTimeout(@timer)
@timer = setTimeout(ProjectsList.filterResults, 500)
filterResults: =>
form = $("#project-list-form")
search = $("#issue_search").val()
uiBox = $('div.projects-list-holder')
filterSelector = $(this).data('filter-selector') || 'span.filter-title'
$('.projects-list-holder').css("opacity", '0.5')
form = $("#project-list-form")
project_filter_url = form.attr('action') + '?' + form.serialize()
$.ajax
type: "GET"
......
class @User
constructor: ->
$('.profile-groups-avatars').tooltip("placement": "top")
new ProjectsList()
ProjectsList.init()
$('.hide-project-limit-message').on 'click', (e) ->
path = '/'
......
......@@ -15,7 +15,7 @@
.nav-controls
= form_tag '', method: :get, class: 'project-list-form', id: 'project-list-form' do |f|
.append-right-10.hidden-xs.hidden-sm
= search_field_tag :filter_projects, params[:filter_projects], placeholder: 'Filter by name...', class: 'projects-list-filter form-control issue_search search-text-input', spellcheck: false, id: 'projects-list-filter'
= search_field_tag :filter_projects, params[:filter_projects], placeholder: 'Filter by name...', class: 'projects-list-filter form-control search-text-input', spellcheck: false, id: 'projects-list-filter'
- if current_user.can_create_project?
= link_to new_project_path, class: 'btn btn-new' do
= icon('plus')
......
......@@ -3,4 +3,4 @@
= render 'shared/projects/list', ci: true
:javascript
new ProjectsList();
ProjectsList.init()
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