From 5c933b40e53f10a5f89bbcccdd5da79f492ec650 Mon Sep 17 00:00:00 2001 From: uniun Date: Mon, 18 Mar 2013 15:57:20 +0200 Subject: [PATCH 1/3] BUG SilverStripeNavigator shows wrong message. The message was always 'Published Site'. Also there were no 'active' class on links. --- code/controllers/SilverStripeNavigator.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/controllers/SilverStripeNavigator.php b/code/controllers/SilverStripeNavigator.php index 1ce2e17d..ef9de13e 100644 --- a/code/controllers/SilverStripeNavigator.php +++ b/code/controllers/SilverStripeNavigator.php @@ -82,7 +82,7 @@ class SilverStripeNavigator extends ViewableData { $text = $item->getHTML(); if($text) $html .= $text; $newMessage = $item->getMessage(); - if($newMessage) $message = $newMessage; + if($newMessage && $item->isActive()) $message = $newMessage; } return array( @@ -217,7 +217,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem { $draftPage = $this->getDraftPage(); if($draftPage) { $this->recordLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage"); - return "recordLink\">". _t('ContentController.DRAFTSITE', 'Draft Site') .""; + return "isActive() ? 'class="current" ' : '') ."href=\"$this->recordLink\">". _t('ContentController.DRAFTSITE', 'Draft Site') .""; } } @@ -265,7 +265,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem { $livePage = $this->getLivePage(); if($livePage) { $this->recordLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live"); - return "recordLink\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') .""; + return "isActive() ? 'class="current" ' : '') ."href=\"$this->recordLink\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') .""; } } @@ -286,7 +286,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem { } public function isActive() { - return (!Versioned::current_stage() || Versioned::current_stage() == 'Live'); + return ((!Versioned::current_stage() || Versioned::current_stage() == 'Live') && !Versioned::current_archived_date()); } protected function getLivePage() { @@ -308,13 +308,12 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem { public function getHTML() { $this->recordLink = $this->record->AbsoluteLink(); - return "recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') .""; + return "isActive() ? ' current' : '') ."\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') .""; } public function getMessage() { if($date = Versioned::current_archived_date()) { - $dateObj = Datetime::create(); - $dateObj->setValue($date); + $dateObj = DBField::create_field('Datetime', $date); return "
". _t('ContentController.ARCHIVEDSITEFROM', 'Archived site from') ."
" . $dateObj->Nice() . "
"; } } From db853f2c3c1cfb9a83744e685d3a67e9b8215736 Mon Sep 17 00:00:00 2001 From: uniun Date: Mon, 18 Mar 2013 16:28:28 +0200 Subject: [PATCH 2/3] Make message always visible at the top of the page Make message always visible at the top of the page like the message in CMS preview iframe. --- css/SilverStripeNavigator.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/SilverStripeNavigator.css b/css/SilverStripeNavigator.css index 24d390cc..4b0b0d7a 100644 --- a/css/SilverStripeNavigator.css +++ b/css/SilverStripeNavigator.css @@ -16,7 +16,7 @@ #SilverStripeNavigator .bottomTabs a.current { font-weight: bold; text-decoration: none; } -#SilverStripeNavigatorMessage { font-family: 'Lucida Grande', Verdana, Arial, 'sans-serif'; position: absolute; right: 20px; top: 40px; padding: 10px; border-color: #c99; color: #fff; background-color: #c00; border: 1px solid #000; } +#SilverStripeNavigatorMessage { font-family: 'Lucida Grande', Verdana, Arial, 'sans-serif'; position: fixed; z-index: 1000; right: 20px; top: 40px; padding: 10px; border-color: #c99; color: #fff; background-color: #c00; border: 1px solid #000; } #SilverStripeNavigatorLinkPopup { display: none; position: absolute; top: -60px; height: 50px; width: 350px; left: 200px; background-color: white; border: 1px solid black; z-index: 100; color: black; padding: 5px; } From e8f7f3db7f60995c7f9d7fe76f97068d72e891b6 Mon Sep 17 00:00:00 2001 From: uniun Date: Mon, 18 Mar 2013 16:29:10 +0200 Subject: [PATCH 3/3] Make message always visible at the top of the page Make message always visible at the top of the page like the message in CMS preview iframe. --- scss/SilverStripeNavigator.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scss/SilverStripeNavigator.scss b/scss/SilverStripeNavigator.scss index 029bc1bf..b10243c6 100644 --- a/scss/SilverStripeNavigator.scss +++ b/scss/SilverStripeNavigator.scss @@ -1,4 +1,3 @@ - #SilverStripeNavigator { position: fixed; bottom: 0; @@ -51,7 +50,8 @@ #SilverStripeNavigatorMessage { font-family: 'Lucida Grande', Verdana, Arial, 'sans-serif'; - position: absolute; + position: fixed; + z-index: 1000; right: 20px; top: 40px; padding: 10px;