From 92154219648a8d752e67c77ec8474b3bbd7afdf1 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 29 May 2015 21:33:45 +1000 Subject: [PATCH] Fix dropdown (context menu) UI --- modules/system/assets/ui/docs/dropdown.md | 43 ++++++--- modules/system/assets/ui/js/dropdown.js | 102 ++++++++++++++++++++++ 2 files changed, 133 insertions(+), 12 deletions(-) diff --git a/modules/system/assets/ui/docs/dropdown.md b/modules/system/assets/ui/docs/dropdown.md index 993b12bf6..42932293e 100644 --- a/modules/system/assets/ui/docs/dropdown.md +++ b/modules/system/assets/ui/docs/dropdown.md @@ -2,15 +2,34 @@ Customized dropdown menu # Example - + +
+ + +
diff --git a/modules/system/assets/ui/js/dropdown.js b/modules/system/assets/ui/js/dropdown.js index bd2b13629..3f58a8956 100644 --- a/modules/system/assets/ui/js/dropdown.js +++ b/modules/system/assets/ui/js/dropdown.js @@ -1,3 +1,105 @@ /* =require ../vendor/bootstrap/js/dropdown.js */ +/* + * Dropdown menus. + * + * This script customizes the Twitter Bootstrap drop-downs. + * + */ ++function ($) { "use strict"; + + $(document).on('shown.bs.dropdown', '.dropdown', function(){ + $(document.body).addClass('dropdown-open') + + var dropdown = $('.dropdown-menu', this), + dropdownContainer = $(this).data('dropdown-container') + + if ($('.dropdown-container', dropdown).length == 0) { + var + title = $('[data-toggle=dropdown]', this).text(), + titleAttr = dropdown.data('dropdown-title'), + timer = null; + + if (titleAttr !== undefined) + title = titleAttr + + $('li:first-child', dropdown).addClass('first-item') + dropdown.prepend($('
  • ').addClass('dropdown-title').text(title)) + + var + container = $('
  • ').addClass('dropdown-container'), + ul = $('