mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
js: clean up suggestion code
This commit is contained in:
parent
6c53d351a1
commit
dcff193063
@ -248,7 +248,7 @@
|
||||
*/
|
||||
refreshSuggestionList: function($suggestions, $el)
|
||||
{
|
||||
$suggestions.load(icinga.config.baseUrl + '/director/suggest', {
|
||||
$suggestions.load(this.module.icinga.config.baseUrl + '/director/suggest', {
|
||||
value: $el.val(),
|
||||
context: $el.data('suggestion-context')
|
||||
}, function (responseText, textStatus, jqXHR) {
|
||||
@ -281,13 +281,13 @@
|
||||
{
|
||||
var $el = $suggestion.closest('ul').siblings('.director-suggest');
|
||||
var val = $suggestion.text();
|
||||
var $list =
|
||||
$el.val(val);
|
||||
|
||||
if (val.match(/\.$/)) {
|
||||
$el.val(val);
|
||||
this.getSuggestionList($el, true);
|
||||
} else {
|
||||
$el.focus();
|
||||
$el.val(val);
|
||||
$el.trigger('change');
|
||||
this.getSuggestionList($el).remove();
|
||||
}
|
||||
@ -305,6 +305,9 @@
|
||||
{
|
||||
var $list = this.getSuggestionList($el);
|
||||
var $active = $list.find('li.active');
|
||||
if ($active.length === 0) {
|
||||
$active = $list.find('li:hover');
|
||||
}
|
||||
if ($active.length) {
|
||||
this.chooseSuggestion($active);
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user