Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG SilverStripeNavigator shows wrong message. #303

Merged
merged 3 commits into from Mar 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions code/controllers/SilverStripeNavigator.php
Expand Up @@ -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(
Expand Down Expand Up @@ -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>";
}
}

Expand Down Expand Up @@ -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>";
}
}

Expand All @@ -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() {
Expand All @@ -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>";
}
}
Expand Down
2 changes: 1 addition & 1 deletion css/SilverStripeNavigator.css
Expand Up @@ -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; }

Expand Down
4 changes: 2 additions & 2 deletions scss/SilverStripeNavigator.scss
@@ -1,4 +1,3 @@

#SilverStripeNavigator {
position: fixed;
bottom: 0;
Expand Down Expand Up @@ -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;
Expand Down