2013-05-02 07:51:47 -04:00
|
|
|
class SearchAutocomplete
|
2014-01-18 07:16:46 -05:00
|
|
|
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
|
|
|
|
|
2013-05-02 07:51:47 -04:00
|
|
|
$("#search").autocomplete
|
2014-01-18 07:16:46 -05:00
|
|
|
source: search_autocomplete_path + query
|
|
|
|
minLength: 1
|
2013-05-02 07:51:47 -04:00
|
|
|
select: (event, ui) ->
|
|
|
|
location.href = ui.item.url
|
|
|
|
|
|
|
|
@SearchAutocomplete = SearchAutocomplete
|