blob: 384b95118c9f9b05e19c40092f782a28dda0f481 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
@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()
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')
$('.projects-list-holder').css("opacity", '0.5')
project_filter_url = form.attr('action') + '?' + form.serialize()
$.ajax
type: "GET"
url: form.attr('action')
data: form.serialize()
complete: ->
$('.projects-list-holder').css("opacity", '1.0')
success: (data) ->
$('.projects-list-holder').html(data.html)
# Change url so if user reload a page - search results are saved
history.replaceState {page: project_filter_url}, document.title, project_filter_url
dataType: "json"
uiBox.find("ul.projects-list li.bottom").hide()
|