From 272b7ae660d8927107a4466d7201a1b56efb1a7b Mon Sep 17 00:00:00 2001 From: Cam Findlay Date: Wed, 10 Dec 2014 14:35:05 +1300 Subject: [PATCH] FIX Showing the stable and outdated version number correctly. --- code/extensions/DocumentationViewerVersionWarning.php | 6 +++--- templates/Includes/DocumentationVersion_warning.ss | 4 ++-- templates/Layout/DocumentationViewer_DocumentationPage.ss | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/extensions/DocumentationViewerVersionWarning.php b/code/extensions/DocumentationViewerVersionWarning.php index 7a7351b..b5bd7cc 100644 --- a/code/extensions/DocumentationViewerVersionWarning.php +++ b/code/extensions/DocumentationViewerVersionWarning.php @@ -30,17 +30,17 @@ class DocumentationViewerVersionWarning extends Extension { $stable = $this->owner->getManifest()->getStableVersion($entity); $compare = $entity->compare($stable); - + if($entity->getVersion() == "master" || $compare > 0) { return $this->owner->customise(new ArrayData(array( 'FutureRelease' => true, - 'StableVersion' => DBField::create_field('HTMLText', $stable) + 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) ))); } else { return $this->owner->customise(new ArrayData(array( 'OutdatedRelease' => true, - 'StableVersion' => DBField::create_field('HTMLText', $stable) + 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) ))); } diff --git a/templates/Includes/DocumentationVersion_warning.ss b/templates/Includes/DocumentationVersion_warning.ss index 090c8d7..a77bca3 100644 --- a/templates/Includes/DocumentationVersion_warning.ss +++ b/templates/Includes/DocumentationVersion_warning.ss @@ -2,9 +2,9 @@
<% loop VersionWarning %> <% if OutdatedRelease %> -

This document contains information for an outdated version <% if Top.Version %>($Top.Version)<% end_if %> and may not be maintained any more. If some of your projects still use this version, consider upgrading as soon as possible.

+

This document contains information for an outdated version <% if $Version %>($Version)<% end_if %> and may not be maintained any more. If some of your projects still use this version, consider upgrading as soon as possible.

<% else_if FutureRelease %> -

This document contains information about a future release <% if StableVersion %>and not the current stable version ($StableVersion)<% end_if %>. Be aware that information on this page may change and API's may not be stable for production use.

+

This document contains information about a future release <% if $VersionWarning.StableVersion %>and not the current stable version ($VersionWarning.StableVersion)<% end_if %>. Be aware that information on this page may change and API's may not be stable for production use.

<% end_if %> <% end_loop %>
diff --git a/templates/Layout/DocumentationViewer_DocumentationPage.ss b/templates/Layout/DocumentationViewer_DocumentationPage.ss index 774eeb5..72ef306 100755 --- a/templates/Layout/DocumentationViewer_DocumentationPage.ss +++ b/templates/Layout/DocumentationViewer_DocumentationPage.ss @@ -1,6 +1,6 @@
<% if VersionWarning %> - <% include DocumentationVersion_warning %> + <% include DocumentationVersion_warning Version=$Entity.Version %> <% end_if %> <% include DocumentationTableContents %>