From d6cdd6d23924b2a1ce2506e40d75876d51ab8a8c Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Thu, 14 Oct 2010 21:12:08 -0700 Subject: [PATCH] Getting live writer support hooked back up to blogs ...w/out breaking blogs' paging --HG-- branch : dev --- .../Orchard.Blogs/Controllers/BlogController.cs | 3 ++- .../Modules/Orchard.Blogs/Orchard.Blogs.csproj | 2 ++ .../Modules/Orchard.Blogs/Placement.info | 3 ++- .../Orchard.Blogs/RemoteBlogPublishingShapes.cs | 16 ++++++++++++++++ src/Orchard.Web/Modules/Orchard.Blogs/Routes.cs | 5 ++++- .../ViewModels/DisplayBlogViewModel.cs | 4 +--- .../Modules/Orchard.Blogs/Views/Blog/Item.cshtml | 10 ++++------ .../Orchard.Blogs/Views/Items/Blog.cshtml | 13 +++---------- .../Views/RemoteBlogPublishing.cshtml | 7 +++++++ 9 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 src/Orchard.Web/Modules/Orchard.Blogs/RemoteBlogPublishingShapes.cs create mode 100644 src/Orchard.Web/Modules/Orchard.Blogs/Views/RemoteBlogPublishing.cshtml diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs index b7ccc5c1e..5523068e1 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs @@ -62,9 +62,10 @@ namespace Orchard.Blogs.Controllers { var list = Shape.List(); list.AddRange(blogPosts); + var blogShape = _services.ContentManager.BuildDisplay(blog); var model = new DisplayBlogViewModel { + Blog = blogShape, BlogPostList = list, - BlogPart = blog, Page = page, PageSize = pageSize }; diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index 98eaf1aa8..f66a94a27 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -106,6 +106,7 @@ + @@ -159,6 +160,7 @@ Designer + diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info b/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info index 022d20e01..7a90c2c0e 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info @@ -6,7 +6,8 @@ - + { + if (displaying.ShapeMetadata.DisplayType == "Detail") { + displaying.ShapeMetadata.Wrappers.Add("RemoteBlogPublishing"); + } + }); + } + } +} diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Routes.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Routes.cs index e979ab47f..452e6783d 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Routes.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Routes.cs @@ -207,6 +207,7 @@ namespace Orchard.Blogs { new MvcRouteHandler()) }, new RouteDescriptor { + Priority = 11, Route = new Route( "{blogSlug}/wlwmanifest.xml", new RouteValueDictionary { @@ -223,6 +224,7 @@ namespace Orchard.Blogs { new MvcRouteHandler()) }, new RouteDescriptor { + Priority = 11, Route = new Route( "{blogSlug}/rsd", new RouteValueDictionary { @@ -283,7 +285,8 @@ namespace Orchard.Blogs { {"action", "Item"} }, new RouteValueDictionary { - {"blogSlug", _blogSlugConstraint} + {"blogSlug", _blogSlugConstraint}, + {"page", @"^\d+$"} }, new RouteValueDictionary { {"area", "Orchard.Blogs"} diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/ViewModels/DisplayBlogViewModel.cs b/src/Orchard.Web/Modules/Orchard.Blogs/ViewModels/DisplayBlogViewModel.cs index 626690efa..9639d425e 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/ViewModels/DisplayBlogViewModel.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/ViewModels/DisplayBlogViewModel.cs @@ -1,8 +1,6 @@ -using Orchard.Blogs.Models; - namespace Orchard.Blogs.ViewModels { public class DisplayBlogViewModel { - public BlogPart BlogPart { get; set; } + public dynamic Blog { get; set; } public dynamic BlogPostList { get; set; } public int Page { get; set; } public int PageSize { get; set; } diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml index 609b08f2f..7b03eeae4 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml @@ -1,28 +1,26 @@ @model Orchard.Blogs.ViewModels.DisplayBlogViewModel @using Orchard.Blogs.Extensions; - @{ Style.Include("pagination.css"); } - +@Display(Model.Blog) @if (Model.BlogPostList.Items.Count > 0) { @Display(Model.BlogPostList)
    @if(Model.BlogPostList.Items.Count == Model.PageSize) {
  • - @Html.ActionLink(T("Older Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.BlogPart.Slug, page = Model.Page + 1 }) + @Html.ActionLink(T("Older Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.Blog.Slug, page = Model.Page + 1 })
  • } @if(Model.Page > 1) {
  • - @Html.ActionLink(T("Newer Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.BlogPart.Slug, page = Model.Page - 1 }) + @Html.ActionLink(T("Newer Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.Blog.Slug, page = Model.Page - 1 })
  • }
} else {

@T("There are no posts for this blog.")

-} - +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Blog.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Blog.cshtml index 8a70f8a90..f1709ff14 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Blog.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Blog.cshtml @@ -1,10 +1,3 @@ -@using Orchard.Blogs.Extensions; -@using Orchard.UI.Resources; -@{ - RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest((string)Model.Slug) }); - RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd((string)Model.Slug) }); -} -

@Html.TitleForPage((string)Model.Title)

-@Display(Model.manage) -@Display(Model.metadata) -@Display(Model.Primary) \ No newline at end of file +

@Html.TitleForPage((string)Model.Title)

+@Display(Model.Meta) +@Display(Model.Content) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/RemoteBlogPublishing.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/RemoteBlogPublishing.cshtml new file mode 100644 index 000000000..7738a4e9f --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/RemoteBlogPublishing.cshtml @@ -0,0 +1,7 @@ +@using Orchard.Blogs.Extensions; +@using Orchard.UI.Resources; +@{ + RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest((string)Model.Slug) }); + RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd((string)Model.Slug) }); +} +@Display.PlaceChildContent(Source: Model) \ No newline at end of file