Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX: Consistently style custom defined page icons.

* Renamed generateTreeStylingCSS() to generatePageIconsCSS().
* Removed legacy icon definitions.
  • Loading branch information...
commit a6cee248e04cf67075ceb0e6515c313e69cb721e 1 parent 3e00370
@ajshort ajshort authored
View
18 code/controllers/CMSMain.php
@@ -57,7 +57,7 @@ public function init() {
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 @@ public function SiteTreeHints() {
*
* @return String CSS
*/
- function generateTreeStylingCSS() {
+ public function generatePageIconsCss() {
$css = '';
$classes = ClassInfo::subclassesFor('SiteTree');
@@ -427,20 +427,14 @@ function generateTreeStylingCSS() {
$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;
View
2  code/controllers/CMSPageAddController.php
@@ -20,7 +20,7 @@ function AddForm() {
$pageTypes = array();
foreach($this->PageTypes() as $type) {
- $html = sprintf('<span class="icon class-%s"></span><strong class="title">%s</strong><span class="description">%s</span>',
+ $html = sprintf('<span class="page-icon class-%s"></span><strong class="title">%s</strong><span class="description">%s</span>',
$type->getField('ClassName'),
$type->getField('AddAction'),
$type->getField('Description')
View
4 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(
View
4 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;
Please sign in to comment.
Something went wrong with that request. Please try again.