From d8cce35dc85835aea24c04341c0f1fdbe04d75ce Mon Sep 17 00:00:00 2001 From: ichim-david Date: Thu, 17 Sep 2015 00:07:06 +0300 Subject: [PATCH] Refs #950; fixed the following toolbar issues: - Menus are now closed when switching from expanded to contracted and back - Clicking the personal bar link now closes the subset menu as well - Fixed the position of the subset menus when collapsed by removing the hardcoded value of 105px from toolbar.plone.less --- .../patterns/toolbar/src/css/toolbar.plone.less | 4 +--- .../CMFPlone/static/patterns/toolbar/src/toolbar.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Products/CMFPlone/static/patterns/toolbar/src/css/toolbar.plone.less b/Products/CMFPlone/static/patterns/toolbar/src/css/toolbar.plone.less index 43bc01c05e..c4a6b10fe8 100644 --- a/Products/CMFPlone/static/patterns/toolbar/src/css/toolbar.plone.less +++ b/Products/CMFPlone/static/patterns/toolbar/src/css/toolbar.plone.less @@ -331,12 +331,10 @@ body.userrole-authenticated { overflow-y: auto; height: 0; } - #plone-toolbar-more-subset > li ul { - top: 105px; - } nav > ul li.active ul { height: inherit; max-height: 1000px; // trick to activate transition + top: auto; } li.active > a:after { border-bottom: 10px solid #2a2a2a; diff --git a/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js b/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js index db8f49374b..214d0bf0c4 100644 --- a/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js +++ b/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js @@ -106,8 +106,8 @@ define([ $('body').addClass(that.options.classNames.topExpanded); $('body').removeClass(that.options.classNames.topDefault); } - that.hideElements(); } + that.hideElements(); }); $('nav > ul > li li', that.$container).off('click').on('click', function(event) { @@ -128,7 +128,10 @@ define([ } else { // close existing opened contentmenus - $('nav li', that.$container).removeClass(active_class); + $('.' + active_class, that.$container).removeClass(active_class); + // we need to close the more subset as well not just the content-menus + // when we click on the personal bar + $("#plone-toolbar-more-subset").hide(); } $('nav li > ul', $(this)).css({'margin-top': ''}); // unset this so we get fly-in affect if (!hasClass) { @@ -290,8 +293,11 @@ define([ }); that.moveViewsToSubset($pers_bar_container, $content_views, $toolbar_more_subset); - + var active_class = that.options.classNames.active; $toolbar_more_options.find('a').on('click', function(event){ + // close existing opened contentmenus + $('.' + active_class, that.$container).removeClass(active_class); + var $more_list = $(this).parent(); // properly toggle active class for toolbar_more list item $more_list.toggleClass('active', $toolbar_more_subset.is(":hidden"));