gitlab-org--gitlab-foss/app/assets/javascripts/search_autocomplete.js.coffee
Dmitriy Zaporozhets 073a269831
Refactor search autocomplete. Use ajax for source
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-18 14:16:46 +02:00

13 lines
449 B
CoffeeScript

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
@SearchAutocomplete = SearchAutocomplete