Improve comments and clean up

This commit is contained in:
Matthias Jentsch 2015-08-26 11:38:12 +02:00
parent a7a93803ee
commit 6a43dd9e0e
1 changed files with 4 additions and 15 deletions

View File

@ -145,13 +145,14 @@
// try to active the first item that has an exact URL match
this.setActive($('#menu [href="' + url + '"]'));
// some urls may have custom filters which won't match any menu item. In that case, activate the first
// item that matches *just* the path.
// some urls may have custom filters which won't match any menu item, in that case search
// for a menu item that points to the base action without any filters
if (! this.active) {
this.setActive($('#menu [href="' + this.icinga.utils.parseUrl(url).path + '"]').first());
}
// if no item to the base action exists, activate at least the first URL that matches the base path
// if no item with the base action exists, activate the first URL that beings with the base path
// but may have different filters
if (! this.active) {
this.setActive($('#menu [href^="' + this.icinga.utils.parseUrl(url).path + '"]').first());
}
@ -212,18 +213,6 @@
// TODO: push to history
};
/**
* Get the currently active element
*
* @returns {null|HTMLElement}
*/
Navigation.prototype.getActive = function () {
if (! this.active) {
return null;
}
return this.icinga.utils.getElementByDomPath(this.active);
};
/**
* Reset the active element to nothing
*/