Updated Branches: refs/heads/master addf5b0f8 -> 152e23a00
UI plugins: Fix side nav behavior Due to usability issues, any UI plugins that add a main section (via the addSection function) will now be shown in the 'Plugins' area by clicking on the relevant tile. This is to prevent overflow of the side nav bar caused by too many plugins being loaded. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/152e23a0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/152e23a0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/152e23a0 Branch: refs/heads/master Commit: 152e23a00be69786bf17ab051e6f7fc0402113c1 Parents: addf5b0 Author: Brian Federle <brian.fede...@citrix.com> Authored: Thu Oct 31 11:26:48 2013 -0700 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Thu Oct 31 11:27:50 2013 -0700 ---------------------------------------------------------------------- ui/scripts/plugins.js | 3 ++- ui/scripts/ui-custom/pluginListing.js | 8 ++++++++ ui/scripts/ui/core.js | 19 +++++++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152e23a0/ui/scripts/plugins.js ---------------------------------------------------------------------- diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 50da509..afeae7c 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -51,7 +51,8 @@ }, addSection: function(section) { cloudStack.sections[section.id] = $.extend(section, { - customIcon: 'plugins/' + section.id + '/icon.png' + customIcon: 'plugins/' + section.id + '/icon.png', + isPlugin: true }); }, extend: function(obj) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152e23a0/ui/scripts/ui-custom/pluginListing.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/pluginListing.js b/ui/scripts/ui-custom/pluginListing.js index 1d4a090..e679c62 100644 --- a/ui/scripts/ui-custom/pluginListing.js +++ b/ui/scripts/ui-custom/pluginListing.js @@ -52,6 +52,14 @@ var $browser = $('#browser .container'); $plugin.click(function() { + var $mainSection = $('#navigation ul li').filter('.' + plugin.id); + + if ($mainSection.size()) { + $mainSection.click(); + + return; + } + $browser.cloudBrowser('addPanel', { title: plugin.title, $parent: $('.panel:first'), http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152e23a0/ui/scripts/ui/core.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/core.js b/ui/scripts/ui/core.js index 2ae0b64..06be12b 100644 --- a/ui/scripts/ui/core.js +++ b/ui/scripts/ui/core.js @@ -61,6 +61,10 @@ ); } + if (args.isPlugin) { + $li.hide(); + } + $li.appendTo($navList); return true; @@ -84,18 +88,25 @@ return $(this).hasClass(sectionID); }); var data = args.sections[sectionID]; + var isPlugin = data.isPlugin; data.$browser = $browser; - $navItem.siblings().removeClass('active'); - $navItem.addClass('active'); // Reset browser panels - $browser.cloudBrowser('removeAllPanels'); + if (!isPlugin) { + $navItem.siblings().removeClass('active'); + $navItem.addClass('active'); + $browser.cloudBrowser('removeAllPanels'); + } + $browser.cloudBrowser('addPanel', { title: '<span class="section">' + _l(data.title) + '</span>' + '<span class="subsection"></span>', data: '', complete: function($panel, $breadcrumb) { - $breadcrumb.attr('title', _l(data.title)); + if(!isPlugin) { + $breadcrumb.attr('title', _l(data.title)); + } + data.$breadcrumb = $breadcrumb; // Hide breadcrumb if this is the home section