[test] contact to setting modules
This commit is contained in:
@@ -1,3 +1,33 @@
|
||||
/** =========================
|
||||
* SIDEBAR ACTIVE STATE
|
||||
* Override: activate the parent listing page for manage_* sub-pages.
|
||||
* main.js (theme) handles exact-match pages; this covers second-depth pages.
|
||||
* ========================= */
|
||||
$(function () {
|
||||
var $links = $('#sidebar').find('a.nav-link');
|
||||
var path = window.location.pathname;
|
||||
|
||||
// Theme already handled it — an active link whose href matches the current path
|
||||
var alreadyActive = $links.filter('.active').toArray().some(function (a) {
|
||||
return a.pathname === path;
|
||||
});
|
||||
if (alreadyActive) return;
|
||||
|
||||
// For manage_* pages: strip "manage_" to derive the parent listing filename
|
||||
var filename = path.split('/').pop();
|
||||
if (!/^manage_/.test(filename)) return;
|
||||
|
||||
var dir = path.substring(0, path.lastIndexOf('/'));
|
||||
var parentPath = dir + '/' + filename.replace(/^manage_/, '');
|
||||
|
||||
var $parent = $links.filter(function () { return this.pathname === parentPath; });
|
||||
if ($parent.length) {
|
||||
$links.removeClass('active');
|
||||
$parent.addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/** =========================
|
||||
* UTILITIES
|
||||
* ========================= */
|
||||
|
||||
Reference in New Issue
Block a user