-
- <%if (Model.IsPublished){ %>
- "><%=_Encoded("View")%><%=_Encoded(" | ")%>
- <% } %>
-
- "><%=_Encoded("Edit")%><%=_Encoded(" | ")%>
-
- <%if (Model.Item.ContentItem.VersionRecord.Published == false) { // todo: (heskew) be smart about this and maybe have other contextual actions - including view/preview for view up there ^^
- using (Html.BeginFormAntiForgeryPost(Url.BlogPostPublish(Model.Item.Blog.Slug, Model.Item.Id), FormMethod.Post, new { @class = "inline" })) { %>
-
+
<%
+ if (Model.Item.HasPublished){ %>
+ "><%=_Encoded("View")%><%=_Encoded(" | ")%><%
+ if (Model.Item.HasDraft) { %>
+ "><%=_Encoded("Publish Draft")%><%=_Encoded(" | ")%><%
+ } %>
+ "><%=_Encoded("Unpublish")%><%=_Encoded(" | ")%><%
+ }
+ else { %>
+ "><%=_Encoded("Publish")%><%=_Encoded(" | ")%><%
+ } %>
+ "><%=_Encoded("Edit")%><%=_Encoded(" | ")%><%--
+ if (Model.Item.ContentItem.VersionRecord.Published == false) { // todo: (heskew) be smart about this and maybe have other contextual actions - including view/preview for view up there ^^
+ using (Html.BeginFormAntiForgeryPost(Url.BlogPostPublish(Model.Item.Blog.Slug, Model.Item.Id), FormMethod.Post, new { @class = "inline" })) { %>
<%=_Encoded(" | ")%><%
- }
- } %>
-
- <% using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Id), FormMethod.Post, new { @class = "inline" })) { %>
-
- <%
- } %>
-
+ }
+ }--%><%
+ using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Id), FormMethod.Post, new { @class = "inline" })) { %>
+ <%
+ } %>
<%Html.Zone("meta");%>
-
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/EditorTemplates/Items/Blogs.BlogPost.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/EditorTemplates/Items/Blogs.BlogPost.ascx
index 37b70f9c1..f152780d5 100644
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/EditorTemplates/Items/Blogs.BlogPost.ascx
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/EditorTemplates/Items/Blogs.BlogPost.ascx
@@ -10,10 +10,11 @@
<% Html.Zone("secondary");%>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx
index eba1bd6f3..f88b148c9 100644
--- a/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx
+++ b/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx
@@ -10,10 +10,11 @@
<% Html.Zone("secondary");%>
\ No newline at end of file
diff --git a/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs b/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs
index 5420aae4d..0c3c9109a 100644
--- a/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs
+++ b/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs
@@ -116,9 +116,18 @@ namespace Orchard.Mvc.Html {
return value.HasValue ? htmlHelper.DateTime(value.Value) : defaultIfNull;
}
- //TODO: (erikpo) This format should come from a site setting
+ public static string DateTime(this HtmlHelper htmlHelper, DateTime? value, string defaultIfNull, string customFormat) {
+ return value.HasValue ? htmlHelper.DateTime(value.Value, customFormat) : defaultIfNull;
+ }
+
public static string DateTime(this HtmlHelper htmlHelper, DateTime value) {
- return value.ToString("MMM d yyyy h:mm tt");
+ //TODO: (erikpo) This default format should come from a site setting
+ return htmlHelper.DateTime(value, "MMM d yyyy h:mm tt");
+ }
+
+ public static string DateTime(this HtmlHelper htmlHelper, DateTime value, string customFormat) {
+ //TODO: (erikpo) In the future, convert this to "local" time before calling ToString
+ return value.ToString(customFormat);
}
#endregion
diff --git a/src/Orchard/Mvc/ViewModels/ContentItemViewModel.cs b/src/Orchard/Mvc/ViewModels/ContentItemViewModel.cs
index a4308e0d5..bfc6355c7 100644
--- a/src/Orchard/Mvc/ViewModels/ContentItemViewModel.cs
+++ b/src/Orchard/Mvc/ViewModels/ContentItemViewModel.cs
@@ -36,16 +36,6 @@ namespace Orchard.Mvc.ViewModels {
public string TemplateName { get; set; }
public string Prefix { get; set; }
public ZoneCollection Zones { get; private set; }
-
- public bool IsPublished {
- get { return Item != null && Item.VersionRecord != null && Item.VersionRecord.Published; }
- }
- public bool IsLatest {
- get { return Item != null && Item.VersionRecord != null && Item.VersionRecord.Latest; }
- }
- public bool IsDraft {
- get { return IsLatest && !IsPublished; }
- }
}
public class ContentItemViewModel : ContentItemViewModel where TPart : IContent {