Skip to content

Commit

Permalink
Merge pull request #2473 from betagouv/dev
Browse files Browse the repository at this point in the history
MEP 2018-08-28-02
  • Loading branch information
mmagn authored Aug 28, 2018
2 parents 65a0013 + 83a869c commit dfb734c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions app/javascript/shared/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ function source(url) {

addEventListener('turbolinks:load', function() {
for (let { type, url } of sources) {
let select = autocomplete(selector(type), options, [source(url)]);
select.on('autocomplete:selected', ({ target }, suggestion) => {
$(target).trigger('autocomplete:select', suggestion);
select.autocomplete.setVal(suggestion.label);
});
for (let target of document.querySelectorAll(selector(type))) {
let select = autocomplete(target, options, [source(url)]);
select.on('autocomplete:selected', ({ target }, suggestion) => {
$(target).trigger('autocomplete:select', suggestion);
select.autocomplete.setVal(suggestion.label);
});
}
}
});
2 changes: 1 addition & 1 deletion app/views/admin/procedures/transfer.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
transfer_errors_message(false);
$("#email_admin").val('');

$("#transferModal button#cancel").click();
$('[role=dialog]').modal('hide');
<%- end %>

0 comments on commit dfb734c

Please sign in to comment.