mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Getting live writer support hooked back up to blogs
...w/out breaking blogs' paging --HG-- branch : dev
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
@@ -106,6 +106,7 @@
|
||||
<Compile Include="Services\IBlogPostService.cs" />
|
||||
<Compile Include="Services\IBlogService.cs" />
|
||||
<Compile Include="Services\XmlRpcHandler.cs" />
|
||||
<Compile Include="RemoteBlogPublishingShapes.cs" />
|
||||
<Compile Include="ViewModels\BlogPostArchiveViewModel.cs" />
|
||||
<Compile Include="ViewModels\DisplayBlogViewModel.cs" />
|
||||
</ItemGroup>
|
||||
@@ -159,6 +160,7 @@
|
||||
<None Include="Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Content Include="Views\RemoteBlogPublishing.cshtml" />
|
||||
<None Include="Views\DisplayTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Blogs.RecentBlogPosts.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
||||
|
@@ -6,7 +6,8 @@
|
||||
<Place Parts_Blogs_Blog_Fields="Primary:2"/>
|
||||
<Match ContentType="Blog">
|
||||
<Match DisplayType="Detail">
|
||||
<Place Parts_Blogs_BlogPost_List="Content:5" />
|
||||
<!-- current paging solution makes this redundant
|
||||
<Place Parts_Blogs_BlogPost_List="Content:5" /> -->
|
||||
</Match>
|
||||
<Match DisplayType="DetailAdmin">
|
||||
<Place Parts_Blogs_BlogPost_List_Admin="Content:5"
|
||||
|
@@ -0,0 +1,16 @@
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Blogs {
|
||||
[OrchardFeature("Remote Blog Publishing")]
|
||||
public class RemoteBlogPublishingShapes : IShapeTableProvider {
|
||||
public void Discover(ShapeTableBuilder builder) {
|
||||
builder.Describe("Items_Content__Blog")
|
||||
.OnDisplaying(displaying => {
|
||||
if (displaying.ShapeMetadata.DisplayType == "Detail") {
|
||||
displaying.ShapeMetadata.Wrappers.Add("RemoteBlogPublishing");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -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"}
|
||||
|
@@ -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; }
|
||||
|
@@ -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)
|
||||
|
||||
<ul class="pagination">
|
||||
@if(Model.BlogPostList.Items.Count == Model.PageSize) {
|
||||
<li class="older">
|
||||
@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 })
|
||||
</li>
|
||||
}
|
||||
|
||||
@if(Model.Page > 1) {
|
||||
<li class="newer">
|
||||
@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 })
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
else {
|
||||
<p>@T("There are no posts for this blog.")</p>
|
||||
}
|
||||
|
||||
}
|
@@ -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) });
|
||||
}
|
||||
<h1>@Html.TitleForPage((string)Model.Title)</h1>
|
||||
@Display(Model.manage)
|
||||
@Display(Model.metadata)
|
||||
@Display(Model.Primary)
|
||||
<h1>@Html.TitleForPage((string)Model.Title)</h1>
|
||||
@Display(Model.Meta)
|
||||
@Display(Model.Content)
|
@@ -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)
|
Reference in New Issue
Block a user