mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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();
|
var list = Shape.List();
|
||||||
list.AddRange(blogPosts);
|
list.AddRange(blogPosts);
|
||||||
|
|
||||||
|
var blogShape = _services.ContentManager.BuildDisplay(blog);
|
||||||
var model = new DisplayBlogViewModel {
|
var model = new DisplayBlogViewModel {
|
||||||
|
Blog = blogShape,
|
||||||
BlogPostList = list,
|
BlogPostList = list,
|
||||||
BlogPart = blog,
|
|
||||||
Page = page,
|
Page = page,
|
||||||
PageSize = pageSize
|
PageSize = pageSize
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
<Compile Include="Services\IBlogPostService.cs" />
|
<Compile Include="Services\IBlogPostService.cs" />
|
||||||
<Compile Include="Services\IBlogService.cs" />
|
<Compile Include="Services\IBlogService.cs" />
|
||||||
<Compile Include="Services\XmlRpcHandler.cs" />
|
<Compile Include="Services\XmlRpcHandler.cs" />
|
||||||
|
<Compile Include="RemoteBlogPublishingShapes.cs" />
|
||||||
<Compile Include="ViewModels\BlogPostArchiveViewModel.cs" />
|
<Compile Include="ViewModels\BlogPostArchiveViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DisplayBlogViewModel.cs" />
|
<Compile Include="ViewModels\DisplayBlogViewModel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -159,6 +160,7 @@
|
|||||||
<None Include="Placement.info">
|
<None Include="Placement.info">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
<Content Include="Views\RemoteBlogPublishing.cshtml" />
|
||||||
<None Include="Views\DisplayTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
<None Include="Views\DisplayTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
||||||
<None Include="Views\EditorTemplates\Parts\Blogs.RecentBlogPosts.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Blogs.RecentBlogPosts.cshtml" />
|
||||||
<None Include="Views\EditorTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
<Place Parts_Blogs_Blog_Fields="Primary:2"/>
|
<Place Parts_Blogs_Blog_Fields="Primary:2"/>
|
||||||
<Match ContentType="Blog">
|
<Match ContentType="Blog">
|
||||||
<Match DisplayType="Detail">
|
<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>
|
||||||
<Match DisplayType="DetailAdmin">
|
<Match DisplayType="DetailAdmin">
|
||||||
<Place Parts_Blogs_BlogPost_List_Admin="Content:5"
|
<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 MvcRouteHandler())
|
||||||
},
|
},
|
||||||
new RouteDescriptor {
|
new RouteDescriptor {
|
||||||
|
Priority = 11,
|
||||||
Route = new Route(
|
Route = new Route(
|
||||||
"{blogSlug}/wlwmanifest.xml",
|
"{blogSlug}/wlwmanifest.xml",
|
||||||
new RouteValueDictionary {
|
new RouteValueDictionary {
|
||||||
@@ -223,6 +224,7 @@ namespace Orchard.Blogs {
|
|||||||
new MvcRouteHandler())
|
new MvcRouteHandler())
|
||||||
},
|
},
|
||||||
new RouteDescriptor {
|
new RouteDescriptor {
|
||||||
|
Priority = 11,
|
||||||
Route = new Route(
|
Route = new Route(
|
||||||
"{blogSlug}/rsd",
|
"{blogSlug}/rsd",
|
||||||
new RouteValueDictionary {
|
new RouteValueDictionary {
|
||||||
@@ -283,7 +285,8 @@ namespace Orchard.Blogs {
|
|||||||
{"action", "Item"}
|
{"action", "Item"}
|
||||||
},
|
},
|
||||||
new RouteValueDictionary {
|
new RouteValueDictionary {
|
||||||
{"blogSlug", _blogSlugConstraint}
|
{"blogSlug", _blogSlugConstraint},
|
||||||
|
{"page", @"^\d+$"}
|
||||||
},
|
},
|
||||||
new RouteValueDictionary {
|
new RouteValueDictionary {
|
||||||
{"area", "Orchard.Blogs"}
|
{"area", "Orchard.Blogs"}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using Orchard.Blogs.Models;
|
|
||||||
|
|
||||||
namespace Orchard.Blogs.ViewModels {
|
namespace Orchard.Blogs.ViewModels {
|
||||||
public class DisplayBlogViewModel {
|
public class DisplayBlogViewModel {
|
||||||
public BlogPart BlogPart { get; set; }
|
public dynamic Blog { get; set; }
|
||||||
public dynamic BlogPostList { get; set; }
|
public dynamic BlogPostList { get; set; }
|
||||||
public int Page { get; set; }
|
public int Page { get; set; }
|
||||||
public int PageSize { get; set; }
|
public int PageSize { get; set; }
|
||||||
|
|||||||
@@ -1,28 +1,26 @@
|
|||||||
@model Orchard.Blogs.ViewModels.DisplayBlogViewModel
|
@model Orchard.Blogs.ViewModels.DisplayBlogViewModel
|
||||||
@using Orchard.Blogs.Extensions;
|
@using Orchard.Blogs.Extensions;
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Style.Include("pagination.css");
|
Style.Include("pagination.css");
|
||||||
}
|
}
|
||||||
|
@Display(Model.Blog)
|
||||||
@if (Model.BlogPostList.Items.Count > 0) {
|
@if (Model.BlogPostList.Items.Count > 0) {
|
||||||
@Display(Model.BlogPostList)
|
@Display(Model.BlogPostList)
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
@if(Model.BlogPostList.Items.Count == Model.PageSize) {
|
@if(Model.BlogPostList.Items.Count == Model.PageSize) {
|
||||||
<li class="older">
|
<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>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if(Model.Page > 1) {
|
@if(Model.Page > 1) {
|
||||||
<li class="newer">
|
<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>
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<p>@T("There are no posts for this blog.")</p>
|
<p>@T("There are no posts for this blog.")</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,10 +1,3 @@
|
|||||||
@using Orchard.Blogs.Extensions;
|
<h1>@Html.TitleForPage((string)Model.Title)</h1>
|
||||||
@using Orchard.UI.Resources;
|
@Display(Model.Meta)
|
||||||
@{
|
@Display(Model.Content)
|
||||||
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)
|
|
||||||
@@ -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