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

@ -634,9 +634,9 @@ class DocumentationManifest {
if($check->getLanguage() == $entity->getLanguage()) { if($check->getLanguage() == $entity->getLanguage()) {
$same = ($check->getVersion() == $entity->getVersion()); $same = ($check->getVersion() == $entity->getVersion());
$output->push(new ArrayList(array( $output->push(new ArrayData(array(
'Title' => $entity->getTitle(), 'Title' => $check->getVersion(),
'Link' => $entity->getLink(), 'Link' => $check->Link(),
'LinkingMode' => ($same) ? 'current' : 'link' 'LinkingMode' => ($same) ? 'current' : 'link'
))); )));

View File

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

View File

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

View File

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

View File

@ -2,11 +2,9 @@
<div class="warningBoxTop"> <div class="warningBoxTop">
<% loop VersionWarning %> <% loop VersionWarning %>
<% if OutdatedRelease %> <% 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>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>
<p>If some of your projects still use this version, consider upgrading as soon as possible.</p>
<% else_if FutureRelease %> <% 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>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>
<p>Be aware that information on this page may change and API's may not be stable for production use.</p>
<% end_if %> <% end_if %>
<% end_loop %> <% end_loop %>
</div> </div>

View File

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

View File

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

View File

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