Search fix and CSS update

This commit is contained in:
Ludovic Stephan 2020-07-27 01:32:05 +02:00
parent f6c83dc692
commit d62a8d61de
2 changed files with 19 additions and 2 deletions

View file

@ -194,6 +194,18 @@
/* Account autocomplete window */ /* Account autocomplete window */
.jconfirm #search_autocomplete {
margin-bottom: 0;
}
#account_results {
left:0 !important;
}
#account_results ul li.autocomplete-header {
display:none;
}
#account_results ul { #account_results ul {
list-style-type:none; list-style-type:none;
background:rgba(255,255,255,0.9); background:rgba(255,255,255,0.9);

View file

@ -119,7 +119,7 @@ class AccountSearch {
url: django_urls['kfet.account.search.autocomplete'](), url: django_urls['kfet.account.search.autocomplete'](),
minimumCharacters: 2, minimumCharacters: 2,
id: 'search_autocomplete', id: 'search_autocomplete',
choiceSelector: '.choice', choiceSelector: '.autocomplete-value',
placeholder: "Chercher un utilisateur K-Fêt", placeholder: "Chercher un utilisateur K-Fêt",
container: that._$results_container, container: that._$results_container,
box: that._$results_container, box: that._$results_container,
@ -137,7 +137,12 @@ class AccountSearch {
} }
_on_select(e, choice, autocomplete) { _on_select(e, choice, autocomplete) {
this.manager.set(choice.find('.trigramme').text()); // Une option est de la forme "<User> (<trigramme>)"
var choice_text = choice.text().trim();
var trigramme_regex = /\((.{3})\)$/;
// le match est de la forme [<global match>, <group match>]
trigramme = choice_text.match(trigramme_regex)[1]
this.manager.set(trigramme);
this.close(); this.close();
} }