From 984c11a80f224f822ca48b8d28bb4e74a389b587 Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Fri, 20 May 2011 16:10:34 -0700 Subject: [PATCH] #17825: Showing created instead of published datetime. --HG-- branch : 1.x --- src/Orchard.Web/Core/Common/Shapes.cs | 8 ++++++-- .../Common/Views/Parts.Common.Metadata.Summary.cshtml | 2 +- .../Core/Common/Views/Parts.Common.Metadata.cshtml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Core/Common/Shapes.cs b/src/Orchard.Web/Core/Common/Shapes.cs index 22344ea63..075ea07eb 100644 --- a/src/Orchard.Web/Core/Common/Shapes.cs +++ b/src/Orchard.Web/Core/Common/Shapes.cs @@ -23,8 +23,12 @@ namespace Orchard.Core.Common { } [Shape] - public IHtmlString PublishedState(HtmlHelper Html, DateTime? dateTimeUtc) { - return Html.DateTime(dateTimeUtc, T("Draft")); + public IHtmlString PublishedState(HtmlHelper html, DateTime createdDateTimeUtc, DateTime? publisheddateTimeUtc) { + if (!publisheddateTimeUtc.HasValue) { + return T("Draft"); + } + + return html.DateTime(createdDateTimeUtc); } [Shape] diff --git a/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.Summary.cshtml b/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.Summary.cshtml index 5fa305f6b..eb13c1813 100644 --- a/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.Summary.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.Summary.cshtml @@ -1 +1 @@ -
@Display.PublishedState(dateTimeUtc: Model.ContentPart.PublishedUtc)
\ No newline at end of file +
@Display.PublishedState(createdDateTimeUtc: Model.ContentPart.CreatedUtc, publisheddateTimeUtc: Model.ContentPart.PublishedUtc)
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.cshtml b/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.cshtml index 5fa305f6b..eb13c1813 100644 --- a/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.cshtml @@ -1 +1 @@ -
@Display.PublishedState(dateTimeUtc: Model.ContentPart.PublishedUtc)
\ No newline at end of file +
@Display.PublishedState(createdDateTimeUtc: Model.ContentPart.CreatedUtc, publisheddateTimeUtc: Model.ContentPart.PublishedUtc)
\ No newline at end of file