From a6cee248e04cf67075ceb0e6515c313e69cb721e Mon Sep 17 00:00:00 2001 From: Andrew Short Date: Wed, 13 Jun 2012 17:46:43 +1000 Subject: [PATCH 1/2] BUGFIX: Consistently style custom defined page icons. * Renamed generateTreeStylingCSS() to generatePageIconsCSS(). * Removed legacy icon definitions. --- code/controllers/CMSMain.php | 18 ++++++------------ code/controllers/CMSPageAddController.php | 2 +- code/model/RedirectorPage.php | 4 +--- code/model/VirtualPage.php | 4 +--- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 737b14cf..9ca97dd5 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -57,7 +57,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr parent::init(); Requirements::css(CMS_DIR . '/css/screen.css'); - Requirements::customCSS($this->generateTreeStylingCSS()); + Requirements::customCSS($this->generatePageIconsCss()); Requirements::combine_files( 'cmsmain.js', @@ -405,7 +405,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr * * @return String CSS */ - function generateTreeStylingCSS() { + public function generatePageIconsCss() { $css = ''; $classes = ClassInfo::subclassesFor('SiteTree'); @@ -427,20 +427,14 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $baseFilename = $iconPathInfo['dirname'] . '/' . $iconPathInfo['filename']; $fileExtension = $iconPathInfo['extension']; + $selector = ".page-icon.class-$class, li.class-$class > a .jstree-pageicon"; + if(Director::fileExists($iconFile)) { - $css .= sprintf( - "li.class-%s > a .jstree-pageicon { background: transparent url('%s') 0 0 no-repeat; }\n", - $class, $iconFile - ); + $css .= "$selector { background: transparent url('$iconFile') 0 0 no-repeat; }\n"; } else { // Support for more sophisticated rules, e.g. sprited icons - $css .= sprintf( - "li.class-%s > a .jstree-pageicon { %s }\n", - $class, $iconFile - ); + $css .= "$selector { $iconFile }\n"; } - - } return $css; diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php index ebe58020..5684ae29 100644 --- a/code/controllers/CMSPageAddController.php +++ b/code/controllers/CMSPageAddController.php @@ -20,7 +20,7 @@ class CMSPageAddController extends CMSPageEditController { $pageTypes = array(); foreach($this->PageTypes() as $type) { - $html = sprintf('%s%s', + $html = sprintf('%s%s', $type->getField('ClassName'), $type->getField('AddAction'), $type->getField('Description') diff --git a/code/model/RedirectorPage.php b/code/model/RedirectorPage.php index 102ba68f..964ccc4a 100644 --- a/code/model/RedirectorPage.php +++ b/code/model/RedirectorPage.php @@ -6,9 +6,7 @@ * @subpackage content */ class RedirectorPage extends Page { - - static $icon = "cms/images/treeicons/page-shortcut-file.gif"; - + static $description = 'Redirects to a different internal page'; static $db = array( diff --git a/code/model/VirtualPage.php b/code/model/VirtualPage.php index ff35d7d7..6c2f2cbd 100644 --- a/code/model/VirtualPage.php +++ b/code/model/VirtualPage.php @@ -6,9 +6,7 @@ * @package cms */ class VirtualPage extends Page { - - static $icon = "cms/images/treeicons/page-shortcut-gold-file.gif"; - + static $description = 'Displays the content of another page'; public static $virtualFields; From acc6115154d9fffa2ea2ad956e4d4c9e0d701f47 Mon Sep 17 00:00:00 2001 From: Andrew Short Date: Wed, 13 Jun 2012 17:49:04 +1000 Subject: [PATCH 2/2] MINOR: Removed extra margin from tools add page button. --- css/screen.css | 1 - scss/_CMSMain.scss | 3 --- 2 files changed, 4 deletions(-) diff --git a/css/screen.css b/css/screen.css index fe5b4386..8688eba1 100644 --- a/css/screen.css +++ b/css/screen.css @@ -14,7 +14,6 @@ #cms-content-treeview .cms-tree-expand-trigger { display: none; } .cms-content-tools #cms-content-treeview .cms-content-toolbar { border-bottom: none; box-shadow: none; margin-bottom: 8px; } -.cms-content-tools #cms-content-treeview .cms-content-toolbar .cms-page-add-button { margin-top: 8px; } .cms-content-tools #cms-content-treeview .cms-tree-view-modes, .cms-content-tools #cms-content-treeview .cms-content-batchactions { display: none; } .cms-content-tools #cms-content-treeview .cms-tree-expand-trigger { display: inline-block; margin: 0 0 2px 0; position: absolute; top: 8px; right: 4px; } .cms-content-tools #cms-content-treeview .cms-tree-expand-trigger span.ui-button-text { padding-right: 8px; } diff --git a/scss/_CMSMain.scss b/scss/_CMSMain.scss index 2618b5fe..fc065262 100644 --- a/scss/_CMSMain.scss +++ b/scss/_CMSMain.scss @@ -59,9 +59,6 @@ border-bottom:none; box-shadow:none; margin-bottom:8px; - .cms-page-add-button { - margin-top:8px; - } } .cms-tree-view-modes, .cms-content-batchactions {