From 1616b8d3dde10a1887b4587b6a1d88bc4626effe Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 26 Sep 2014 18:04:03 -0400 Subject: [PATCH] acp breadcrumbs --- public/less/admin/admin.less | 4 ++++ public/src/forum/admin/footer.js | 26 +++++++++++++++++++++++++- src/views/admin/header.tpl | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/public/less/admin/admin.less b/public/less/admin/admin.less index 3ab98650cf..d62d14daf4 100644 --- a/public/less/admin/admin.less +++ b/public/less/admin/admin.less @@ -86,6 +86,10 @@ padding-left: 207px; } + #breadcrumbs { + cursor: default; + } + .wrapper { width: 100%; } diff --git a/public/src/forum/admin/footer.js b/public/src/forum/admin/footer.js index 4fb1c29d5a..4d4332fd50 100644 --- a/public/src/forum/admin/footer.js +++ b/public/src/forum/admin/footer.js @@ -23,8 +23,11 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) { setupACPSearch(); }); - $(window).on('action:ajaxify.end', function() { + $(window).on('action:ajaxify.end', function(ev, data) { + var url = data.url; + setupPills(); + selectMenuItem(data.url); }); setupMainMenu(); @@ -41,6 +44,27 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) { $('.nano').nanoScroller(); } + function selectMenuItem(url) { + $('#main-menu .nav-list > li').removeClass('active').each(function() { + var menu = $(this), + category = menu.parents('.sidebar-nav'), + href = menu.children('a').attr('href'); + + if (href && href.slice(1).indexOf(url) !== -1) { + category.addClass('open'); + menu.addClass('active'); + modifyBreadcrumb(category.find('.nav-header').text(), menu.text()); + return false; + } + }); + } + + function modifyBreadcrumb() { + var caret = ' '; + + $('#breadcrumbs').html(caret + Array.prototype.slice.call(arguments).join(caret)); + } + function setupPills() { $('.navigation.nav-pills li').removeClass('active'); diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl index 6e18248bc3..4ffa8a03e0 100644 --- a/src/views/admin/header.tpl +++ b/src/views/admin/header.tpl @@ -54,7 +54,7 @@ - +