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)
|
refreshSuggestionList: function($suggestions, $el)
|
||||||
{
|
{
|
||||||
$suggestions.load(icinga.config.baseUrl + '/director/suggest', {
|
$suggestions.load(this.module.icinga.config.baseUrl + '/director/suggest', {
|
||||||
value: $el.val(),
|
value: $el.val(),
|
||||||
context: $el.data('suggestion-context')
|
context: $el.data('suggestion-context')
|
||||||
}, function (responseText, textStatus, jqXHR) {
|
}, function (responseText, textStatus, jqXHR) {
|
||||||
@ -281,13 +281,13 @@
|
|||||||
{
|
{
|
||||||
var $el = $suggestion.closest('ul').siblings('.director-suggest');
|
var $el = $suggestion.closest('ul').siblings('.director-suggest');
|
||||||
var val = $suggestion.text();
|
var val = $suggestion.text();
|
||||||
var $list =
|
|
||||||
$el.val(val);
|
|
||||||
|
|
||||||
if (val.match(/\.$/)) {
|
if (val.match(/\.$/)) {
|
||||||
|
$el.val(val);
|
||||||
this.getSuggestionList($el, true);
|
this.getSuggestionList($el, true);
|
||||||
} else {
|
} else {
|
||||||
$el.focus();
|
$el.focus();
|
||||||
|
$el.val(val);
|
||||||
$el.trigger('change');
|
$el.trigger('change');
|
||||||
this.getSuggestionList($el).remove();
|
this.getSuggestionList($el).remove();
|
||||||
}
|
}
|
||||||
@ -305,6 +305,9 @@
|
|||||||
{
|
{
|
||||||
var $list = this.getSuggestionList($el);
|
var $list = this.getSuggestionList($el);
|
||||||
var $active = $list.find('li.active');
|
var $active = $list.find('li.active');
|
||||||
|
if ($active.length === 0) {
|
||||||
|
$active = $list.find('li:hover');
|
||||||
|
}
|
||||||
if ($active.length) {
|
if ($active.length) {
|
||||||
this.chooseSuggestion($active);
|
this.chooseSuggestion($active);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user