From 26cc14a930b8ade65976e64ef38dfa0b62e4e89f Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Thu, 22 Nov 2012 09:46:45 +1300 Subject: [PATCH] API Rework the CMS actions to use alternating buttons and drop-ups. Utilise the new features provided by the framework to get richer interface: * save buttons that highlight the current state of the page * minor actions in a drop-up * embed last publishing and saving information --- code/controllers/CMSMain.php | 12 +++++ code/model/SiteTree.php | 84 ++++++++++++++++++++++--------- javascript/CMSMain.EditForm.js | 44 ++++++++++++++++ templates/SiteTree_Information.ss | 9 ++++ 4 files changed, 126 insertions(+), 23 deletions(-) create mode 100644 templates/SiteTree_Information.ss diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index d194f861..774b9dcc 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -638,6 +638,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $actions = $record->getAllCMSActions(); } else { $actions = $record->getCMSActions(); + + // Find and remove action menus that have no actions. + if ($actions && $actions->Count()) { + $tabset = $actions->fieldByName('ActionMenus'); + if ($tabset) { + foreach ($tabset->getChildren() as $tab) { + if (!$tab->getChildren()->count()) { + $tabset->removeByName($tab->getName()); + } + } + } + } } // Use