mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Improve handling of navigation on link closes
Do not drop active menu when closing the left column, unless there is a different active menu that matches the current state. fixes #9761
This commit is contained in:
parent
47d8b45e6a
commit
96e3845f46
@ -157,6 +157,19 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to select a new URL by
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
|
Navigation.prototype.trySetActiveByUrl = function(url) {
|
||||||
|
var active = this.active;
|
||||||
|
this.setActiveByUrl(url);
|
||||||
|
if (! this.active && active) {
|
||||||
|
this.setActive($(this.icinga.utils.getElementByDomPath(active)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all active elements
|
* Remove all active elements
|
||||||
*/
|
*/
|
||||||
|
@ -570,27 +570,20 @@
|
|||||||
if (! req.autorefresh) {
|
if (! req.autorefresh) {
|
||||||
// TODO: Hook for response/url?
|
// TODO: Hook for response/url?
|
||||||
var url = req.url;
|
var url = req.url;
|
||||||
|
|
||||||
|
if (req.$target[0].id === 'col1') {
|
||||||
|
self.icinga.behaviors.navigation.trySetActiveByUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
var $forms = $('[action="' + this.icinga.utils.parseUrl(url).path + '"]');
|
var $forms = $('[action="' + this.icinga.utils.parseUrl(url).path + '"]');
|
||||||
var $matches = $.merge($('[href="' + url + '"]'), $forms);
|
var $matches = $.merge($('[href="' + url + '"]'), $forms);
|
||||||
$matches.each(function (idx, el) {
|
|
||||||
if ($(el).closest('#menu').length) {
|
|
||||||
if (req.$target[0].id === 'col1') {
|
|
||||||
self.icinga.behaviors.navigation.resetActive();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$matches.each(function (idx, el) {
|
$matches.each(function (idx, el) {
|
||||||
var $el = $(el);
|
var $el = $(el);
|
||||||
if ($el.closest('#menu').length) {
|
if ($el.closest('#menu').length) {
|
||||||
if ($el.is('form')) {
|
if ($el.is('form')) {
|
||||||
$('input', $el).addClass('active');
|
$('input', $el).addClass('active');
|
||||||
} else {
|
|
||||||
if (req.$target[0].id === 'col1') {
|
|
||||||
self.icinga.behaviors.navigation.setActive($el);
|
|
||||||
}
|
}
|
||||||
}
|
// Interrupt .each, only one menu item shall be active
|
||||||
// Interrupt .each, only on menu item shall be active
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -154,7 +154,7 @@
|
|||||||
var kill = this.cutContainer($('#col1'));
|
var kill = this.cutContainer($('#col1'));
|
||||||
this.pasteContainer($('#col1'), col2);
|
this.pasteContainer($('#col1'), col2);
|
||||||
this.fixControls();
|
this.fixControls();
|
||||||
this.icinga.behaviors.navigation.setActiveByUrl($('#col1').data('icingaUrl'));
|
this.icinga.behaviors.navigation.trySetActiveByUrl($('#col1').data('icingaUrl'));
|
||||||
},
|
},
|
||||||
|
|
||||||
cutContainer: function ($col) {
|
cutContainer: function ($col) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user