Merge pull request #505 from creative-commoners/pulls/3.0/blogpoststate-icons

FIX Replace jQuery UI icons with admin font icons
This commit is contained in:
Robbie Averill 2018-01-25 10:54:05 +13:00 committed by GitHub
commit ef2f1165d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 13 deletions

View File

@ -7,9 +7,6 @@
/* /*
* Sprite maps & Icons * Sprite maps & Icons
*/ */
.gridfield-icon.blog-icon-timer {
background: url("../images/blog-icon/timer.png") center no-repeat; }
#FeaturedImage .middleColumn { #FeaturedImage .middleColumn {
clear: none; clear: none;
float: left; } float: left; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 B

View File

@ -12,10 +12,6 @@
// @import "blog-icon/*.png"; // @import "blog-icon/*.png";
// buttons // buttons
.gridfield-icon.blog-icon-timer {
background: url('../images/blog-icon/timer.png') center no-repeat;
}
#FeaturedImage .middleColumn { #FeaturedImage .middleColumn {
clear: none; clear: none;
float: left; float: left;

View File

@ -5,6 +5,7 @@ namespace SilverStripe\Blog\Forms\GridField;
use SilverStripe\Blog\Model\BlogPost; use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Core\Manifest\ModuleLoader; use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState; use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
/** /**
@ -20,7 +21,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
public function getColumnContent($gridField, $record, $columnName) public function getColumnContent($gridField, $record, $columnName)
{ {
if ($columnName == 'State') { if ($columnName == 'State') {
Requirements::css(ModuleLoader::getModule('silverstripe/blog')->getRelativeResourcePath('css/cms.css')); Requirements::css('silverstripe/blog:css/cms.css');
if ($record instanceof BlogPost) { if ($record instanceof BlogPost) {
$modifiedLabel = ''; $modifiedLabel = '';
@ -30,11 +31,11 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
if (!$record->isPublished()) { if (!$record->isPublished()) {
/** /**
* @var SS_Datetime $lastEdited * @var DBDatetime $lastEdited
*/ */
$lastEdited = $record->dbObject('LastEdited'); $lastEdited = $record->dbObject('LastEdited');
return '<i class="btn-icon gridfield-icon btn-icon-pencil"></i> ' . _t( return '<i class="font-icon-edit mr-2"></i> ' . _t(
__CLASS__ . '.Draft', __CLASS__ . '.Draft',
'Saved as Draft on {date}', 'Saved as Draft on {date}',
'State for when a post is saved.', 'State for when a post is saved.',
@ -45,12 +46,12 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
} }
/** /**
* @var SS_Datetime $publishDate * @var DBDatetime $publishDate
*/ */
$publishDate = $record->dbObject('PublishDate'); $publishDate = $record->dbObject('PublishDate');
if (strtotime($record->PublishDate) > time()) { if (strtotime($record->PublishDate) > time()) {
return '<i class="gridfield-icon blog-icon-timer"></i> ' . _t( return '<i class="font-icon-clock mr-2"></i> ' . _t(
__CLASS__ . '.Timer', __CLASS__ . '.Timer',
'Publish at {date}', 'Publish at {date}',
'State for when a post is published.', 'State for when a post is published.',
@ -60,7 +61,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
) . $modifiedLabel; ) . $modifiedLabel;
} }
return '<i class="btn-icon gridfield-icon btn-icon-accept"></i> ' . _t( return '<i class="font-icon-check-mark-circle text-success mr-2"></i> ' . _t(
__CLASS__ . '.Published', __CLASS__ . '.Published',
'Published on {date}', 'Published on {date}',
'State for when a post is published.', 'State for when a post is published.',

View File

@ -59,6 +59,11 @@ class BlogMemberExtension extends DataExtension
$this->owner->URLSegment = preg_replace('/-[0-9]+$/', null, $this->owner->URLSegment) . '-' . $count; $this->owner->URLSegment = preg_replace('/-[0-9]+$/', null, $this->owner->URLSegment) . '-' . $count;
$count++; $count++;
} }
// Auto publish profile images
if ($this->owner->BlogProfileImage() && $this->owner->BlogProfileImage()->exists()) {
$this->owner->BlogProfileImage()->publishSingle();
}
} }
/** /**