summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/search_autocomplete.js.coffee
blob: c1801365266f1f63f7f353f93848e8472cd013b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
class @SearchAutocomplete
  constructor: (search_autocomplete_path, project_id, project_ref) ->
    project_id = '' unless project_id
    project_ref = '' unless project_ref
    query = "?project_id=" + project_id + "&project_ref=" + project_ref

    $("#search").autocomplete
      source: search_autocomplete_path + query
      minLength: 1
      select: (event, ui) ->
        location.href = ui.item.url