Expand and highlight parent menu item when active page sidebar navigation item is a sub menu

This commit is contained in:
Bernd Bestel
2018-07-14 10:28:33 +02:00
parent f018696219
commit 909949a9e1
3 changed files with 14 additions and 7 deletions

View File

@@ -59,12 +59,12 @@ a.discrete-link:focus {
.navbar-sidenav {
overflow-y: auto;
overflow-x: hidden;
border-top: 2px solid !important;
}
.navbar-sidenav,
.sidenav-second-level {
background-color: #e5e5e5 !important;
border-top: 2px solid !important;
border-right: 2px solid !important;
border-color: #d6d6d6 !important;
}

View File

@@ -23,7 +23,14 @@ if (!Grocy.ActiveNav.isEmpty())
{
var menuItem = $('#sidebarResponsive').find("[data-nav-for-page='" + Grocy.ActiveNav + "']");
menuItem.addClass('active-page');
}
var parentMenuSelector = menuItem.data("sub-menu-of");
if (typeof parentMenuSelector !== "undefined")
{
$(parentMenuSelector).collapse("show");
$(parentMenuSelector).prev(".nav-link-collapse").addClass("active-page");
}
}
$.timeago.settings.allowFuture = true;
RefreshContextualTimeago = function()