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); $menu.data('icinga-url', menuDataUrl);
}; };
Navigation.prototype.setActiveByUrl = function(url)
{
this.resetActive();
this.setActive($('#menu [href="' + url + '"]'));
}
/** /**
* Change the active menu element * Change the active menu element
* *

View File

@ -343,7 +343,9 @@
var $matches = $.merge($('[href="' + url + '"]'), $forms); var $matches = $.merge($('[href="' + url + '"]'), $forms);
$matches.each(function (idx, el) { $matches.each(function (idx, el) {
if ($(el).closest('#menu').length) { if ($(el).closest('#menu').length) {
self.icinga.behaviors.navigation.resetActive(); if (req.$target[0].id === 'col1') {
self.icinga.behaviors.navigation.resetActive();
}
} else if ($(el).closest('table.action').length) { } else if ($(el).closest('table.action').length) {
$(el).closest('table.action').find('.active').removeClass('active'); $(el).closest('table.action').find('.active').removeClass('active');
} }
@ -355,7 +357,9 @@
if ($el.is('form')) { if ($el.is('form')) {
$('input', $el).addClass('active'); $('input', $el).addClass('active');
} else { } else {
self.icinga.behaviors.navigation.setActive($el); if (req.$target[0].id === 'col1') {
self.icinga.behaviors.navigation.setActive($el);
}
} }
// Interrupt .each, only on menu item shall be active // Interrupt .each, only on menu item shall be active
return false; return false;

View File

@ -136,6 +136,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'));
}, },
cutContainer: function ($col) { cutContainer: function ($col) {