Update navigation when the url of the main column changes

This commit is contained in:
Matthias Jentsch 2014-10-01 17:47:21 +02:00
parent ec9e9e8dfb
commit ee63dfd310
3 changed files with 13 additions and 2 deletions

View File

@ -77,6 +77,12 @@
$menu.data('icinga-url', menuDataUrl);
};
Navigation.prototype.setActiveByUrl = function(url)
{
this.resetActive();
this.setActive($('#menu [href="' + url + '"]'));
}
/**
* Change the active menu element
*

View File

@ -343,7 +343,9 @@
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();
}
} else if ($(el).closest('table.action').length) {
$(el).closest('table.action').find('.active').removeClass('active');
}
@ -355,8 +357,10 @@
if ($el.is('form')) {
$('input', $el).addClass('active');
} else {
if (req.$target[0].id === 'col1') {
self.icinga.behaviors.navigation.setActive($el);
}
}
// Interrupt .each, only on menu item shall be active
return false;
} else if ($(el).closest('table.action').length) {

View File

@ -136,6 +136,7 @@
var kill = this.cutContainer($('#col1'));
this.pasteContainer($('#col1'), col2);
this.fixControls();
this.icinga.behaviors.navigation.setActiveByUrl($('#col1').data('icingaUrl'));
},
cutContainer: function ($col) {