Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dashboard.js.coffee « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 47f86e317513fa600863c572aaf4ef3fe98fa82f (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
@Dashboard =
  init: ->
    $("input#project-filter-form-field,.projects-list-filter").off('keyup')
    this.initSearch()

  initSearch: ->
    @timer = null
    $("input#project-filter-form-field,.projects-list-filter").on('keyup', ->
      clearTimeout(@timer)
      @timer = setTimeout(Dashboard.filterResults, 500)
    )

  filterResults: =>
    $('.projects-list-holder').fadeTo(250, 0.5)

    form = null
    form = $("form#project-filter-form")
    search = $("input#project-filter-form-field").val()
    project_filter_url = form.attr('action') + '?' + form.serialize()

    $.ajax
      type: "GET"
      url: form.attr('action')
      data: form.serialize()
      complete: ->
        $('.projects-list-holder').fadeTo(250, 1)
      success: (data) ->
        $('.projects-list-holder,.public-projects').replaceWith(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"