parent
1932a912f8
commit
7f0a2d540b
|
@ -27,7 +27,7 @@
|
|||
// restore old menu state
|
||||
if (activeMenuId) {
|
||||
$('[role="navigation"] li.active', el).removeClass('active');
|
||||
var $selectedMenu = $('#' + activeMenuId, el).addClass('active');
|
||||
var $selectedMenu = $('#' + activeMenuId).addClass('active');
|
||||
var $outerMenu = $selectedMenu.parent().closest('li');
|
||||
if ($outerMenu.size()) {
|
||||
$outerMenu.addClass('active');
|
||||
|
@ -74,6 +74,23 @@
|
|||
$menu.data('icinga-url', menuDataUrl);
|
||||
};
|
||||
|
||||
/**
|
||||
* Change the active menu element
|
||||
*
|
||||
* @param $el {jQuery} A selector pointing to the active element
|
||||
*/
|
||||
Navigation.prototype.setActive = function($el) {
|
||||
|
||||
$el.closest('li').addClass('active');
|
||||
$el.parents('li').addClass('active');
|
||||
activeMenuId = $el.closest('li').attr('id');
|
||||
};
|
||||
|
||||
Navigation.prototype.resetActive = function() {
|
||||
$('#menu .active').removeClass('active');
|
||||
activeMenuId = null;
|
||||
};
|
||||
|
||||
Navigation.prototype.menuTitleHovered = function(event) {
|
||||
var $li = $(this),
|
||||
delay = 800,
|
||||
|
|
|
@ -345,7 +345,7 @@
|
|||
|
||||
$matches.each(function (idx, el) {
|
||||
if ($(el).closest('#menu').length) {
|
||||
$('#menu .active').removeClass('active');
|
||||
self.icinga.behaviors.navigation.resetActive();
|
||||
} else if ($(el).closest('table.action').length) {
|
||||
$(el).closest('table.action').find('.active').removeClass('active');
|
||||
}
|
||||
|
@ -357,8 +357,7 @@
|
|||
if ($el.is('form')) {
|
||||
$('input', $el).addClass('active');
|
||||
} else {
|
||||
$el.closest('li').addClass('active');
|
||||
$el.parents('li').addClass('active');
|
||||
self.icinga.behaviors.navigation.setActive($el);
|
||||
}
|
||||
// Interrupt .each, only on menu item shall be active
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue