mirror of
https://github.com/jonom/silverstripe-betternavigator.git
synced 2024-10-22 14:05:51 +02:00
Better support for archived state
This commit is contained in:
parent
068c4cf26c
commit
7c78a7e2ed
@ -30,13 +30,21 @@ class BetterNavigator extends DataExtension {
|
||||
|
||||
//Get SilverStripeNavigator links & stage info (CMS/Stage/Live/Archive)
|
||||
$nav = array();
|
||||
$viewing = '';
|
||||
$navigator = new SilverStripeNavigator($this->owner->dataRecord);
|
||||
$items = $navigator->getItems();
|
||||
foreach($items as $item) {
|
||||
$nav[$item->getName()] = array(
|
||||
$name = $item->getName();
|
||||
$active = $item->isActive();
|
||||
$nav[$name] = array(
|
||||
'Link' => $item->getLink(),
|
||||
'Active' => $item->isActive()
|
||||
'Active' => $active
|
||||
);
|
||||
if ($active) {
|
||||
if ($name == 'LiveLink') $viewing = 'Live';
|
||||
if ($name == 'StageLink') $viewing = 'Draft';
|
||||
if ($name == 'ArchiveLink') $viewing = 'Archived';
|
||||
}
|
||||
}
|
||||
|
||||
//Is the logged in member nominated as a developer?
|
||||
@ -49,6 +57,7 @@ class BetterNavigator extends DataExtension {
|
||||
$bNData = array_merge($nav, array(
|
||||
'Member' => $member,
|
||||
'Stage' => Versioned::current_stage(),
|
||||
'Viewing' => $viewing, // What we're viewing doesn't necessarily align with the active Stage
|
||||
'LoginLink' => Config::inst()->get('Security', 'login_url') . $backURL,
|
||||
'LogoutLink' => 'Security/logout' . $backURL,
|
||||
'Mode' => Director::get_environment_type(),
|
||||
|
@ -40,8 +40,8 @@ span[class^='bn-icon'], span[class*=' bn-icon'] { display: inline-block; }
|
||||
#BetterNavigatorStatus:hover .bn-icon-cog, #BetterNavigatorStatus:hover .bn-icon-close { opacity: 1; }
|
||||
#BetterNavigatorStatus.Live { background: #39b54a; border-color: #33a343; }
|
||||
#BetterNavigatorStatus.Live:hover { background: #36ac46; }
|
||||
#BetterNavigatorStatus.Stage { background: #f26c4f; border-color: #da6147; }
|
||||
#BetterNavigatorStatus.Stage:hover { background: #e6674b; }
|
||||
#BetterNavigatorStatus.Draft { background: #f26c4f; border-color: #da6147; }
|
||||
#BetterNavigatorStatus.Draft:hover { background: #e6674b; }
|
||||
|
||||
#BetterNavigatorContent { padding: 6px; color: #71767a; background: #cfd8de; border: 1px solid #bac2c8; border-width: 0 0 1px 1px; }
|
||||
#BetterNavigatorContent .bn-heading { text-align: center; text-transform: uppercase; font-size: 11px; margin: 8px 0 4px 0; }
|
||||
|
@ -101,7 +101,7 @@ $archiveColor: #6f6f6f;
|
||||
}
|
||||
}
|
||||
|
||||
&.Stage {
|
||||
&.Draft {
|
||||
background: $stageColor;
|
||||
border-color: shade($stageColor, 10);
|
||||
|
||||
|
@ -6,11 +6,9 @@
|
||||
<div id="BetterNavigator" class="collapsed">
|
||||
|
||||
<% with $BetterNavigator %>
|
||||
<div id="BetterNavigatorStatus" class="$Stage">
|
||||
<div id="BetterNavigatorStatus" class="$Viewing">
|
||||
<span class="bn-icon-cog"></span>
|
||||
<% if $LiveLink.Active %>Published<% end_if %>
|
||||
<% if $StageLink.Active %>Draft<% end_if %>
|
||||
<% if $ArchiveLink.Active %>Archived<% end_if %>
|
||||
$Viewing
|
||||
<span class="bn-icon-close"></span>
|
||||
</div>
|
||||
<% end_with %>
|
||||
@ -20,21 +18,25 @@
|
||||
<div class="bn-links">
|
||||
|
||||
<% with $BetterNavigator %>
|
||||
<% if not $LiveLink.Active %>
|
||||
<% if $LiveLink.Link %>
|
||||
<a href="$LiveLink.Link"><span class="bn-icon-view"></span>View published</a>
|
||||
<% else %>
|
||||
<span class="bn-disabled"><span class="bn-icon-view"></span>Not yet published</span>
|
||||
<% if $ArchiveLink.Active %>
|
||||
<a href="$CMSLink.Link" target="_blank"><span class="bn-icon-edit"></span>Restore</a>
|
||||
<% else %>
|
||||
<% if not $LiveLink.Active %>
|
||||
<% if $LiveLink.Link %>
|
||||
<a href="$LiveLink.Link"><span class="bn-icon-view"></span>View live</a>
|
||||
<% else %>
|
||||
<span class="bn-disabled"><span class="bn-icon-view"></span>Not yet published</span>
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
<% if not $StageLink.Active %>
|
||||
<% if $StageLink.Link %>
|
||||
<a href="$StageLink.Link"><span class="bn-icon-view"></span>View draft</a>
|
||||
<% else %>
|
||||
<span class="bn-disabled"><span class="bn-icon-view"></span>Deleted from draft site</span>
|
||||
<% if not $StageLink.Active %>
|
||||
<% if $StageLink.Link %>
|
||||
<a href="$StageLink.Link"><span class="bn-icon-view"></span>View draft</a>
|
||||
<% else %>
|
||||
<span class="bn-disabled"><span class="bn-icon-view"></span>Deleted from draft site</span>
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
<a href="$CMSLink.Link" target="_blank"><span class="bn-icon-edit"></span>Edit in CMS</a>
|
||||
<% end_if %>
|
||||
<a href="$CMSLink.Link" target="_blank"><span class="bn-icon-edit"></span>Edit in CMS</a>
|
||||
|
||||
<% if $Member %>
|
||||
<a href="$LogoutLink"><span class="bn-icon-user"></span>Log out<% if $Member.FirstName %><span class="light"> ($Member.FirstName)</span><% end_if %></a>
|
||||
|
Loading…
Reference in New Issue
Block a user