From 1e1049b5c82dd4d0e00aa1fd5f4a09e5f3ed7c20 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 14 Mar 2013 17:31:36 +0100 Subject: [PATCH] NEW "Show children as list" tree context action Allows for easier navigation between tree and list, particularly if a node has many children nodes (since it doesn't require expanding that node). Uses a new 'ss-tabs-force-active' class on the tabset to enforce the correct view state. This also fixes an issue where you couldn't link to a list view directly via URL. --- javascript/CMSMain.Tree.js | 17 ++++++++++++++++- javascript/lang/en_US.js | 1 + templates/Includes/CMSMain_TreeView.ss | 2 +- .../Includes/CMSPagesController_Content.ss | 4 ++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js index cbd56f91..6d98c8aa 100644 --- a/javascript/CMSMain.Tree.js +++ b/javascript/CMSMain.Tree.js @@ -12,12 +12,27 @@ 'edit': { 'label': ss.i18n._t('Tree.EditPage'), 'action': function(obj) { - $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf( + $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf( self.data('urlEditpage'), obj.data('id') )); } } }; + + // Add "show as list" + if(!node.hasClass('nochildren')) { + menuitems['showaslist'] = { + 'label': ss.i18n._t('Tree.ShowAsList'), + 'action': function(obj) { + $('.cms-container').entwine('.ss').loadPanel( + self.data('urlListview') + '&ParentID=' + obj.data('id'), + null, + // Default to list view tab + {tabState: {'pages-controller-cms-content': {'tabSelector': '.content-listview'}}} + ); + } + }; + } // Build a list for allowed children as submenu entries var pagetype = node.data('pagetype'), diff --git a/javascript/lang/en_US.js b/javascript/lang/en_US.js index 667c15e6..fa21cabc 100644 --- a/javascript/lang/en_US.js +++ b/javascript/lang/en_US.js @@ -33,6 +33,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') { 'Tree.EditPage': 'Edit', 'Tree.ThisPageOnly': 'This page only', 'Tree.ThisPageAndSubpages': 'This page and subpages', + 'Tree.ShowAsList': 'Show children as list', 'CMSMain.ConfirmRestoreFromLive': "Do you really want to copy the published content to the draft site?", 'CMSMain.RollbackToVersion': "Do you really want to roll back to version #%s of this page?", 'URLSEGMENT.Edit': 'Edit', diff --git a/templates/Includes/CMSMain_TreeView.ss b/templates/Includes/CMSMain_TreeView.ss index 83cec419..79e9c543 100644 --- a/templates/Includes/CMSMain_TreeView.ss +++ b/templates/Includes/CMSMain_TreeView.ss @@ -19,7 +19,7 @@ $ExtraTreeTools <% end_if %> -
+
$SiteTreeAsUL
diff --git a/templates/Includes/CMSPagesController_Content.ss b/templates/Includes/CMSPagesController_Content.ss index 967ecd8d..da373bfc 100644 --- a/templates/Includes/CMSPagesController_Content.ss +++ b/templates/Includes/CMSPagesController_Content.ss @@ -7,10 +7,10 @@