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

Delay filter until user stops typing

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