From e5a0f25d94034c6be45a4cc0b1c838df4f16c45e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 9 Jul 2015 16:48:53 +0100 Subject: [PATCH] Keep sidebar tab menu in alphabetical order --- editor/js/ui/menu.js | 44 ++++++++++++++++++++++++++++++--------- editor/js/ui/sidebar.js | 3 ++- locales/en-US/editor.json | 2 +- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/editor/js/ui/menu.js b/editor/js/ui/menu.js index 941e810d9..47fe824fc 100644 --- a/editor/js/ui/menu.js +++ b/editor/js/ui/menu.js @@ -29,7 +29,7 @@ RED.menu = (function() { return null; } } - + function setInitialState() { var savedStateActive = isSavedStateActive(opt.id); if (savedStateActive) { @@ -52,12 +52,16 @@ RED.menu = (function() { item = $('
  • '); } else { item = $('
  • '); - + + if (opt.group) { + item.addClass("menu-group-"+opt.group); + + } var linkContent = ''; if (opt.toggle) { linkContent += ''; linkContent += ''; - + } if (opt.icon !== undefined) { if (/\.png/.test(opt.icon)) { @@ -66,16 +70,16 @@ RED.menu = (function() { linkContent += ' '; } } - + if (opt.sublabel) { linkContent += ''+opt.label+''+ ''+opt.sublabel+'' } else { linkContent += ''+opt.label+'' } - + linkContent += ''; - + var link = $(linkContent).appendTo(item); menuItems[opt.id] = opt; @@ -139,7 +143,7 @@ RED.menu = (function() { content: opt.tip }); } - + } @@ -154,8 +158,8 @@ RED.menu = (function() { // $("#"+options.id+"-submenu").show(); // event.preventDefault(); //}); - - + + var topMenu = $("