diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index 0d4f7cd..3ae33c2 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -130,6 +130,7 @@ $.extend(TableHeader, {
/**
* Sum all [data-offset-top] values and cache it.
+ * @todo move this out of tableheader.js into a move generic place like drupal.js.
*/
computeOffsetTop: function () {
var $offsets = $('[data-offset-top]');
diff --git a/core/modules/shortcut/shortcut.base.css b/core/modules/shortcut/shortcut.base.css
index 90a1046..5af1151 100644
--- a/core/modules/shortcut/shortcut.base.css
+++ b/core/modules/shortcut/shortcut.base.css
@@ -5,19 +5,6 @@
*/
/**
- * Toolbar.
- */
-#edit-shortcuts {
- float: right; /* LTR */
-}
-#shortcut-toolbar ul {
- float: left; /* LTR */
-}
-#shortcut-toolbar .icon {
- float: left; /* LTR */
-}
-
-/**
* Add/remove links.
*/
.add-or-remove-shortcuts .icon {
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index 9bbb12a..840a68b 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -716,10 +716,10 @@ function shortcut_preprocess_page(&$variables) {
* Implements hook_page_alter().
*/
function shortcut_page_alter(&$page) {
- if (isset($page['page_top']['toolbar'])) {
+ if (isset($page['page_bottom']['toolbar'])) {
// If the toolbar is available, add a pre-render function to display the
// current shortcuts in the toolbar drawer.
- $page['page_top']['toolbar']['#pre_render'][] = 'shortcut_toolbar_pre_render';
+ $page['page_bottom']['toolbar']['#pre_render'][] = 'shortcut_toolbar_pre_render';
}
}
@@ -734,8 +734,6 @@ function shortcut_toolbar_pre_render($toolbar) {
drupal_get_path('module', 'shortcut') . '/shortcut.theme.css',
),
);
- $links['#prefix'] = '
')
+ .css({
+ height: '100%',
+ position: 'relative'
+ })
+ .addClass('fleximenu')
+ )
+ .parent()
+ // Bind event handlers.
+ .on({
+ 'setup.toolbar': context.accordionSetup
+ });
+ // Create a set of list-manipulation callbacks.
+ // Called when items are added or removed.
+ var listUpdate = $.Callbacks();
+ // Set visibility
+ listUpdate.add(context.initItems);
+ listUpdate.add($.proxy(context, 'markListLevels', $root));
+ listUpdate.add($.proxy(context, 'setLevelVisibility', $root, 1));
+ $wrapper
+ .on('listChange.toolbar', listUpdate.fire)
+ .on('clean.toolbar.accordionMode', 'li', context.cleanItem)
+ .on('activate.toolbar.accordionMode', 'li', context.activateItem)
+ .on('click.toolbar.accordionMode', '.handle', context.accordionToggle)
+ .trigger('setup');
+ });
+ },
+ accordionSetup: function (event) {
+ event.stopPropagation();
+ // Mark up the lists and items.
+ $(this)
+ .trigger('listChange');
+
+ },
+ cleanItem: function (event) {},
+ activateItem: function (event) {},
+ accordionToggle: function (event) {
+ // The toggle.
+ var $toggle = $(this);
+ var $item = $toggle.closest('li');
+ var $list = $item.children('ul');
+ var isHidden = $list.hasClass('dormant');
+ // Toggle the item open state.
+ $item
+ [((isHidden) ? 'add' : 'remove') + 'Class']('open');
+ // Toggle the item list visibility.
+ $list
+ ['slide' + ((isHidden) ? 'Down' : 'Up')]()
+ [((isHidden) ? 'remove' : 'add') + 'Class']('dormant');
+ // Twist the toggle.
+ $toggle
+ [((isHidden) ? 'add' : 'remove') + 'Class']('open');
+
+ },
+ initItems: function (event) {
+ // The accordion wrapper.
+ var $wrapper = $(this);
+ var rootClass = 'root';
+ var boxClass = 'box';
+ var handleClass = 'handle';
+ // Get lists and items.
+ var $root = $wrapper.children('.' + rootClass);
+ var $ul = $wrapper.find('ul').once('fleximenu');
+ var $li = $wrapper.find('li').once('fleximenu');
+ // Basic setup
+ $ul
+ .each(function (index, element) {
+ $(this).data('toolbar', {
+ processed: false,
+ type: 'list',
+ level: NaN
+ });
+ });
+ // Initialize items and their links.
+ $li
+ .each(function (index, element) {
+ $(this).data('toolbar', {
+ processed: false,
+ type: 'item'
+ });
+ })
+ // Add a class to item links.
+ .children('a')
+ .wrap(
+ $('
', {
+ 'class': boxClass
+ })
+ )
+ .end()
+ // Add a handle to each list item if it has a menu.
+ .each(function (index, element) {
+ var $item = $(this);
+ if ($item.children('ul').length > 0) {
+ $item
+ .children('.' + boxClass)
+ .prepend(
+ $('', {
+ 'class': handleClass,
+ text: ''
+ })
+ );
+ }
+ });
+ },
+ /**
+ * Adds a level class to each list based on its depth in the menu.
+ */
+ markListLevels: function ($lists, level, event) {
+ level = (typeof level === 'object') ? 1 : level;
+ $lists
+ .addClass('level-' + level)
+ .each(function (index, element) {
+ $(this).data().toolbar.level = level;
+ });
+ $lists = $lists.children('li').children('ul');
+ if ($lists.length > 0) {
+ this.markListLevels($lists, (level + 1));
+ }
+ },
+ setLevelVisibility: function ($lists, visibleAfter) {
+ var level;
+ $lists
+ .each(function (index, element) {
+ var $this = $(this);
+ level = $(this).data().toolbar.level;
+ if (level > visibleAfter) {
+ $this.addClass('dormant');
+ }
+ else {
+ $this.addClass('visible');
+ }
+ });
+ $lists = $lists.children('li').children('ul');
+ if ($lists.length > 0) {
+ this.setLevelVisibility($lists, visibleAfter);
+ }
+ }
+});
+
+// Assign the ToolBar obect to the Drupal namespace.
+Drupal.ToolBar = ToolBar;
+}(jQuery));
diff --git a/core/modules/toolbar/templates/toolbar.tpl.php b/core/modules/toolbar/templates/toolbar.tpl.php
index 5b03fee..8b8c4af 100644
--- a/core/modules/toolbar/templates/toolbar.tpl.php
+++ b/core/modules/toolbar/templates/toolbar.tpl.php
@@ -19,15 +19,33 @@
* @ingroup themeable
*/
?>
-