From b084fe817779b7abd74583c5ddb93f6f7a53d48d Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Wed, 7 Feb 2018 16:47:24 +1300 Subject: [PATCH] NEW Convert page history notice to use Bootstrap 4 info alert --- code/Controllers/CMSPageHistoryController.php | 12 ++++++------ .../CMS/Controllers/Includes/CMSMain_notice.ss | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/Controllers/CMSPageHistoryController.php b/code/Controllers/CMSPageHistoryController.php index 795a2829..03db22a8 100644 --- a/code/Controllers/CMSPageHistoryController.php +++ b/code/Controllers/CMSPageHistoryController.php @@ -220,10 +220,10 @@ class CMSPageHistoryController extends CMSMain $id ); - $view = _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.VIEW', "view"); + $view = _t(__CLASS__ . '.VIEW', "view"); $message = _t( - 'SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.COMPARINGVERSION', + __CLASS__ . '.COMPARINGVERSION', "Comparing versions {version1} and {version2}.", array( 'version1' => sprintf('%s (%s)', $versionID, Controller::join_links($link, $versionID), $view), @@ -234,10 +234,10 @@ class CMSPageHistoryController extends CMSMain $revert->setReadonly(true); } else { if ($record->isLatestVersion()) { - $message = _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.VIEWINGLATEST', 'Currently viewing the latest version.'); + $message = _t(__CLASS__ . '.VIEWINGLATEST', 'Currently viewing the latest version.'); } else { $message = _t( - 'SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.VIEWINGVERSION', + __CLASS__ . '.VIEWINGVERSION', "Currently viewing version {version}.", array('version' => $versionID) ); @@ -247,9 +247,9 @@ class CMSPageHistoryController extends CMSMain /** @var Tab $mainTab */ $mainTab = $fields->fieldByName('Root.Main'); $mainTab->unshift( - new LiteralField('CurrentlyViewingMessage', ArrayData::create(array( + LiteralField::create('CurrentlyViewingMessage', ArrayData::create(array( 'Content' => DBField::create_field('HTMLFragment', $message), - 'Classes' => 'notice' + 'Classes' => 'alert alert-info' ))->renderWith($this->getTemplatesWithSuffix('_notice'))) ); diff --git a/templates/SilverStripe/CMS/Controllers/Includes/CMSMain_notice.ss b/templates/SilverStripe/CMS/Controllers/Includes/CMSMain_notice.ss index fb51174e..239cc0ba 100644 --- a/templates/SilverStripe/CMS/Controllers/Includes/CMSMain_notice.ss +++ b/templates/SilverStripe/CMS/Controllers/Includes/CMSMain_notice.ss @@ -1,3 +1,3 @@ -
-

$Content

+
+ $Content