Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS navigation menu: Add active class #2786

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ui/src/core/xibo-cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ $(function() {
}());
}

// Highlight navigation
const $sideBarWrapperScroll = $('#sidebar-wrapper ul.sidebar');
const $selectedMenu = $sideBarWrapperScroll.find('li.sidebar-list a[href="' +
window.location.pathname +
'"]').addClass('sidebar-list-selected');

// Scroll into view if needed
if (
$selectedMenu.offset().top + $selectedMenu.height() >
$sideBarWrapperScroll.height() - $sideBarWrapperScroll[0].scrollTop
) {
$selectedMenu[0].scrollIntoView();
}

// Every minute
setInterval('XiboPing(\'' + clockUrl + '\')', 1000 * 60);

Expand Down
10 changes: 10 additions & 0 deletions web/theme/compact/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ ul.sidebar .sidebar-list a {
ul.sidebar .sidebar-list a:hover {
color: #fff;
border-left: 3px solid #e99d1a;
text-indent: 13px;
}
ul.sidebar .sidebar-list a.sidebar-list-selected {
color: #fff;
border-left: 3px solid #e99d1a;
text-indent: 13px;
}
#page-wrapper:not(.active) ul.sidebar .sidebar-list a:hover span {
border-left: 3px solid #e99d1a;
Expand Down Expand Up @@ -421,6 +427,10 @@ ul.sidebar .sidebar-list a:hover,
/* Sidebar header and footer color */
background: #273759;
}
.sidebar-list a.sidebar-list-selected {
/* Sidebar selected */
background: #2c3d63;
}
#sidebar-wrapper {
/* Sidebar background color */
background: #30426a;
Expand Down
10 changes: 10 additions & 0 deletions web/theme/default/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ ul.sidebar .sidebar-list a {
ul.sidebar .sidebar-list a:hover {
color: #fff;
border-left: 3px solid #e99d1a;
text-indent: 13px;
}
ul.sidebar .sidebar-list a.sidebar-list-selected {
color: #fff;
border-left: 3px solid #e99d1a;
text-indent: 13px;
}
#page-wrapper:not(.active) ul.sidebar .sidebar-list a:hover span {
border-left: 3px solid #e99d1a;
Expand Down Expand Up @@ -417,6 +423,10 @@ ul.sidebar .sidebar-list a:hover,
/* Sidebar header and footer color */
background: #273759;
}
.sidebar-list a.sidebar-list-selected {
/* Sidebar selected */
background: #2c3d63;
}
#sidebar-wrapper {
/* Sidebar background color */
background: #30426a;
Expand Down