diff --git a/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js b/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js index 67ea3d5a8c..7ed3812832 100644 --- a/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js +++ b/Products/CMFPlone/static/patterns/toolbar/src/toolbar.js @@ -216,43 +216,69 @@ define([ expanded: that.state.expanded }), {path: '/'}); }, + moveViewsToSubset: function($container, $views, $subset) { + var i, $content_view, length = $views.length - 1; + if ($container.offset().top !== 0) { + for (i = length; length >= 0; length -= 1) { + $content_view = $views.eq(i); + $content_view.hide().clone(true, true).appendTo($subset).show(); + if ($container.offset().top === 0) { + break; + } + } + } + }, hideElements: function(){ + var that = this; if(this.state.left){ // only when on top return; } var w = $('.plone-toolbar-container').width(), wtc = $('.plone-toolbar-logo').width(); - $( ".plone-toolbar-main > li" ).each(function() { - wtc += $(this).width(); + var $plone_toolbar_main = $( ".plone-toolbar-main"); + var $toolbar_menus = $plone_toolbar_main.find("> li" ); + $toolbar_menus.each(function() { + wtc += $(this).width(); }); - - $('#personal-bar-container > li').each(function() { + var $pers_bar_container = $('#personal-bar-container'); + $pers_bar_container.find('> li').each(function() { wtc += $(this).width(); }); - wtc -= $('#plone-toolbar-more-options').width(); + var $toolbar_more_options = $('#plone-toolbar-more-options'); + wtc -= $toolbar_more_options.width(); + var $content_menus = $toolbar_menus.filter($('[id^="plone-contentmenu-"]')); + var $content_views = $toolbar_menus.filter($('[id^="contentview-"]')); if (w < wtc) { - if (!($('#plone-toolbar-more-options').length)) { - $('[id^="plone-contentmenu-"]').hide(); - $('.plone-toolbar-main').append('