Replace typeahead with simpler autocomplete
This commit is contained in:
parent
2500cd516b
commit
e1f1827320
21 changed files with 119 additions and 4818 deletions
|
@ -57,32 +57,7 @@ function validatePath(path) {
|
|||
}
|
||||
|
||||
function path_type_init() {
|
||||
display = 'label';
|
||||
|
||||
var bloodhound = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(display),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
|
||||
remote: {
|
||||
url: '/admin/procedures/path_list?request=%QUERY',
|
||||
wildcard: '%QUERY'
|
||||
}
|
||||
});
|
||||
bloodhound.initialize();
|
||||
|
||||
$("#procedure_path").typeahead({
|
||||
minLength: 1
|
||||
}, {
|
||||
display: display,
|
||||
source: bloodhound,
|
||||
templates: {
|
||||
empty: 'Ce lien est disponible !',
|
||||
suggestion: Handlebars.compile("<div class='path-mine-{{mine}}'>{{label}}</div>")
|
||||
},
|
||||
limit: 5
|
||||
});
|
||||
|
||||
$('#procedure_path').bind('typeahead:select', function(ev, suggestion) {
|
||||
$('#procedure_path').bind('autocomplete:select', function(ev, suggestion) {
|
||||
togglePathMessage(true, suggestion['mine']);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -148,8 +148,8 @@ function jsObject_to_array(qp_list) {
|
|||
}
|
||||
|
||||
function add_event_search_address() {
|
||||
$("#search-by-address input[type='address']").bind('typeahead:select', function (ev, seggestion) {
|
||||
get_address_point(seggestion['label']);
|
||||
$("#search-by-address input[type='address']").bind('autocomplete:select', function (ev, suggestion) {
|
||||
get_address_point(suggestion['label']);
|
||||
});
|
||||
|
||||
$("#search-by-address input[type='address']").keypress(function (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue