Improve comments and clean up
This commit is contained in:
parent
a7a93803ee
commit
6a43dd9e0e
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue