Skip to content

Commit

Permalink
Update navigation when the url of the main column changes
Browse files Browse the repository at this point in the history
  • Loading branch information
majentsch committed Oct 1, 2014
1 parent ec9e9e8 commit ee63dfd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions public/js/icinga/behavior/navigation.js
Expand Up @@ -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
*
Expand Down
8 changes: 6 additions & 2 deletions public/js/icinga/loader.js
Expand Up @@ -343,7 +343,9 @@
var $matches = $.merge($('[href="' + url + '"]'), $forms);
$matches.each(function (idx, el) {
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) {
$(el).closest('table.action').find('.active').removeClass('active');
}
Expand All @@ -355,7 +357,9 @@
if ($el.is('form')) {
$('input', $el).addClass('active');
} 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
return false;
Expand Down
1 change: 1 addition & 0 deletions public/js/icinga/ui.js
Expand Up @@ -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) {
Expand Down

0 comments on commit ee63dfd

Please sign in to comment.