Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #303 from uniun/patch-1

BUG SilverStripeNavigator shows wrong message.
  • Loading branch information...
commit 79c9d31099470c47894e74ab422e555b05f942a6 2 parents 0f8d7a0 + e8f7f3d
Ingo Schommer chillu authored
13 code/controllers/SilverStripeNavigator.php
View
@@ -82,7 +82,7 @@ static public function get_for_record($record) {
$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 @@ public function getHTML() {
$draftPage = $this->getDraftPage();
if($draftPage) {
$this->recordLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage");
- return "<a href=\"$this->recordLink\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</a>";
+ return "<a ". ($this->isActive() ? 'class="current" ' : '') ."href=\"$this->recordLink\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</a>";
}
}
@@ -265,7 +265,7 @@ public function getHTML() {
$livePage = $this->getLivePage();
if($livePage) {
$this->recordLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live");
- return "<a href=\"$this->recordLink\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</a>";
+ return "<a ". ($this->isActive() ? 'class="current" ' : '') ."href=\"$this->recordLink\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</a>";
}
}
@@ -286,7 +286,7 @@ public function canView($member = null) {
}
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 "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
+ return "<a class=\"ss-ui-button". ($this->isActive() ? ' current' : '') ."\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
}
public function getMessage() {
if($date = Versioned::current_archived_date()) {
- $dateObj = Datetime::create();
- $dateObj->setValue($date);
+ $dateObj = DBField::create_field('Datetime', $date);
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.ARCHIVEDSITEFROM', 'Archived site from') ."<br>" . $dateObj->Nice() . "</div>";
}
}
2  css/SilverStripeNavigator.css
View
@@ -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; }
4 scss/SilverStripeNavigator.scss
View
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.