From df66338fd10aba86ad4c0dc8d915ae44f1120958 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Tue, 21 Sep 2010 21:38:20 -0700 Subject: [PATCH] Finished converting Core.Contents --HG-- branch : dev --- .../Core/Contents/Drivers/ContentsDriver.cs | 13 +++++++++++++ .../Parts/Contents.Publish.SummaryAdmin.cshtml | 18 ++++++++++++++++++ .../Parts/Contents.Publish.cshtml | 1 + src/Orchard.Web/Core/Orchard.Core.csproj | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs create mode 100644 src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.SummaryAdmin.cshtml create mode 100644 src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.cshtml diff --git a/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs b/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs new file mode 100644 index 000000000..880de3228 --- /dev/null +++ b/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs @@ -0,0 +1,13 @@ +using Orchard.ContentManagement; +using Orchard.ContentManagement.Drivers; +using Orchard.Core.Contents.ViewModels; +using Orchard.Core.ContentsLocation.Models; + +namespace Orchard.Core.Contents.Drivers { + public class ContentsDriver : ContentPartDriver { + protected override DriverResult Display(ContentPart part, string displayType) { + var location = part.GetLocation(displayType, "secondary", null); + return ContentPartTemplate(new PublishContentViewModel(part.ContentItem), "Parts/Contents.Publish").LongestMatch(displayType, "Summary", "SummaryAdmin").Location(location); + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.SummaryAdmin.cshtml b/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.SummaryAdmin.cshtml new file mode 100644 index 000000000..e2d93ff18 --- /dev/null +++ b/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.SummaryAdmin.cshtml @@ -0,0 +1,18 @@ +@using Orchard.ContentManagement +@using Orchard.Utility.Extensions +@{ + Script.Require("ShapesBase"); +} +@if (Model.HasPublished) { +@Html.ItemDisplayLink(T("View").Text, (ContentItem)Model.ContentItem) +@T(" | ") + if (Model.HasDraft) { +@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = Model.ContentItem.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" }) +@T(" | ") + } +@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = Model.ContentItem.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString() }), new { itemprop = "UnpublishUrl UnsafeUrl" }) +@T(" | ") +} else { +@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = Model.ContentItem.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" }) +@T(" | ") +} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.cshtml b/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.cshtml new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Parts/Contents.Publish.cshtml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index 69a853366..639b2e755 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -87,6 +87,7 @@ + @@ -266,6 +267,8 @@ + +