Restore support for multiple versions in the masthead

This commit is contained in:
Will Rossiter 2014-11-15 11:41:01 +13:00
parent fbe7c861a5
commit 5cbd9c79cd
8 changed files with 72 additions and 28 deletions

View File

@ -626,17 +626,17 @@ class DocumentationManifest {
if(!$entity) {
return null;
}
$output = new ArrayList();
foreach($this->getEntities() as $check) {
if($check->getKey() == $entity->getKey()) {
if($check->getLanguage() == $entity->getLanguage()) {
$same = ($check->getVersion() == $entity->getVersion());
$output->push(new ArrayList(array(
'Title' => $entity->getTitle(),
'Link' => $entity->getLink(),
$output->push(new ArrayData(array(
'Title' => $check->getVersion(),
'Link' => $check->Link(),
'LinkingMode' => ($same) ? 'current' : 'link'
)));

View File

@ -322,6 +322,11 @@ class DocumentationViewer extends Controller {
continue;
}
// only show entities with the same version
if($entity->getVersion() !== $current->getVersion()) {
continue;
}
$mode = 'link';
$children = new ArrayList();
@ -454,7 +459,7 @@ class DocumentationViewer extends Controller {
* @return ArrayList
*/
public function getVersions() {
return $this->manifest->getVersions($this->getEntity);
return $this->manifest->getVersions($this->getEntity());
}
/**

View File

@ -159,11 +159,46 @@ html {
}
#masthead {
padding:50px 0;
padding: 50px 0;
background:#f6f7f8;
position:relative;
}
#masthead.has_versions {
padding-bottom: 0;
}
#masthead .wrapper {
overflow: hidden;
}
.versions {
float: right;
}
.versions p {
margin: 0 0 5px;
font-size: 12px;
}
.versions ul {
margin: 0;
padding: 0;
}
.versions li {
list-style: none;
display: block;
float: left;
margin: 0 0 0 5px;
}
.versions li a {
padding: 10px 15px;
display: block;
}
.versions .current {
background: #fff;
}
.menu-toggle {
position:absolute;
right:20px;
@ -389,7 +424,8 @@ html {
.warning,
.alert,
.info,
.pageSkip {
.pageSkip,
.warningBox {
border-radius:4px;
padding: 10px 20px;
clear: both;
@ -406,7 +442,8 @@ html {
.notice p,
.alert p,
.warning p,
.info p {
.info p,
.warningBox p {
margin-bottom: 0;
font-weight:400;
}
@ -417,7 +454,8 @@ html {
}
.notice,
.note {
.note,
.warningBox {
background: #F9F17A;
}
@ -449,26 +487,30 @@ html {
background: url(../../docsviewer/images/warning.png) no-repeat 18px 14px;
}
#content .warningBoxTop h1 {
.warningBoxTop h1 {
margin-bottom: 0;
}
#content .warningBoxTop ul {
.warningBoxTop ul {
margin: 9px 0 18px;
}
#content .warningBoxTop li {
.warningBoxTop li {
margin-bottom: 0;
}
#content .warningBoxBottom {
.warningBox {
margin-top: 0;
}
.warningBoxBottom {
background-color: #0973A6;
padding: 12px 0 16px;
}
#content .warningBoxBottom a { color: #fff; }
#content .warningBoxBottom a:hover { color: #f3fbfe; }
#content .warningBoxBottom ul { margin: 0 0 0 40px; }
#content .warningBoxBottom li { background: none; margin-bottom: 0; }
.warningBoxBottom a { color: #fff; }
.warningBoxBottom a:hover { color: #f3fbfe; }
.warningBoxBottom ul { margin: 0 0 0 40px; }
.warningBoxBottom li { background: none; margin-bottom: 0; }
.doc-breadcrumbs {
}

View File

@ -3,7 +3,7 @@
<html>
<% include DocumentationHead %>
<div id="masthead">
<div id="masthead" <% if Versions %>class="has_versions"<% end_if %>>
<div class="wrapper">
<% if Breadcrumbs.count > 1 %>
<% include DocumentationBreadcrumbs %>
@ -15,6 +15,8 @@
<p>$Page.Introduction</p>
</div>
<% end_if %>
<% include DocumentationVersions %>
</div>
</div>

View File

@ -2,11 +2,9 @@
<div class="warningBoxTop">
<% loop VersionWarning %>
<% if OutdatedRelease %>
<p>This document contains information for an <strong>outdated</strong> version <% if Top.Version %>(<strong>$Top.Version</strong>)<% end_if %> and may not be maintained any more.</p>
<p>If some of your projects still use this version, consider upgrading as soon as possible.</p>
<p>This document contains information for an <strong>outdated</strong> version <% if Top.Version %>(<strong>$Top.Version</strong>)<% end_if %> and may not be maintained any more. If some of your projects still use this version, consider upgrading as soon as possible.</p>
<% else_if FutureRelease %>
<p>This document contains information about a <strong>future</strong> release <% if StableVersion %>and not the current stable version (<strong>$StableVersion</strong>)<% end_if %>.</p>
<p>Be aware that information on this page may change and API's may not be stable for production use.</p>
<p>This document contains information about a <strong>future</strong> release <% if StableVersion %>and not the current stable version (<strong>$StableVersion</strong>)<% end_if %>. Be aware that information on this page may change and API's may not be stable for production use.</p>
<% end_if %>
<% end_loop %>
</div>

View File

@ -1,5 +1,7 @@
<% if Versions %>
<div class="versions">
<p>Versions:</p>
<ul>
<% loop Versions %>
<li><a href="$Link" class="$LinkingMode">$Title</a></li>

View File

@ -19,8 +19,6 @@
<h1>$Title</h1>
<% end_if %>
<% include DocumentationVersions %>
<% if VersionWarning %>
<% include DocumentationVersion_warning %>
<% end_if %>

View File

@ -1,7 +1,4 @@
<div id="documentation-page" class="box">
<% include DocumentationVersions %>
<% if VersionWarning %>
<% include DocumentationVersion_warning %>
<% end_if %>