debian-mirror-gitlab/app/assets/javascripts/projects_list.js.coffee

25 lines
753 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
class @ProjectsList
constructor: ->
$(".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')
2015-04-26 12:48:37 +05:30
if terms == "" || terms == undefined
uiBox.find("ul.projects-list li").show()
2015-04-26 12:48:37 +05:30
else
uiBox.find("ul.projects-list li").each (index) ->
name = $(this).find("span.filter-title").text()
2015-04-26 12:48:37 +05:30
if name.toLowerCase().search(terms.toLowerCase()) == -1
$(this).hide()
else
$(this).show()
uiBox.find("ul.projects-list li.bottom").hide()
2015-04-26 12:48:37 +05:30