mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Shifting blogs
This commit is contained in:
@@ -70,7 +70,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
}
|
||||
|
||||
|
||||
_feedManager.Register(blogPart);
|
||||
_feedManager.Register(blogPart, _services.ContentManager.GetItemMetadata(blogPart).DisplayText);
|
||||
var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize)
|
||||
.Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
|
||||
dynamic blog = _services.ContentManager.BuildDisplay(blogPart);
|
||||
|
@@ -56,7 +56,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var list = Shape.List();
|
||||
list.AddRange(_blogPostService.Get(blogPart, archive).Select(b => _services.ContentManager.BuildDisplay(b, "Summary")));
|
||||
|
||||
_feedManager.Register(blogPart);
|
||||
_feedManager.Register(blogPart, _services.ContentManager.GetItemMetadata(blogPart).DisplayText);
|
||||
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
|
@@ -36,7 +36,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
protected override DriverResult Editor(BlogArchivesPart part, dynamic shapeHelper) {
|
||||
var viewModel = new BlogArchivesViewModel {
|
||||
BlogId = part.BlogId,
|
||||
Blogs = _blogService.Get().ToList().OrderBy(b => b.Name)
|
||||
Blogs = _blogService.Get().ToList().OrderBy(b => _contentManager.GetItemMetadata(b).DisplayText)
|
||||
};
|
||||
|
||||
return ContentShape("Parts_Blogs_BlogArchives_Edit",
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Feeds;
|
||||
|
||||
@@ -8,14 +9,18 @@ namespace Orchard.Blogs.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class BlogPostPartDriver : ContentPartDriver<BlogPostPart> {
|
||||
private readonly IFeedManager _feedManager;
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public BlogPostPartDriver(IFeedManager feedManager) {
|
||||
public BlogPostPartDriver(IFeedManager feedManager, IContentManager contentManager) {
|
||||
_feedManager = feedManager;
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
protected override DriverResult Display(BlogPostPart part, string displayType, dynamic shapeHelper) {
|
||||
if (displayType.StartsWith("Detail"))
|
||||
_feedManager.Register(part.BlogPart);
|
||||
if (displayType.StartsWith("Detail")) {
|
||||
var blogTitle = _contentManager.GetItemMetadata(part.BlogPart).DisplayText;
|
||||
_feedManager.Register(part.BlogPart, blogTitle);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
var viewModel = new RecentBlogPostsViewModel {
|
||||
Count = part.Count,
|
||||
BlogId = part.BlogId,
|
||||
Blogs = _blogService.Get().ToList().OrderBy(b => b.Name)
|
||||
Blogs = _blogService.Get().ToList().OrderBy(b => _contentManager.GetItemMetadata(b).DisplayText)
|
||||
};
|
||||
|
||||
return ContentShape("Parts_Blogs_RecentBlogPosts_Edit",
|
||||
|
@@ -4,9 +4,9 @@ using Orchard.Core.Feeds;
|
||||
|
||||
namespace Orchard.Blogs.Extensions {
|
||||
public static class FeedManagerExtensions {
|
||||
public static void Register(this IFeedManager feedManager, BlogPart blogPart) {
|
||||
feedManager.Register(blogPart.Name, "rss", new RouteValueDictionary { { "containerid", blogPart.Id } });
|
||||
feedManager.Register(blogPart.Name + " - Comments", "rss", new RouteValueDictionary { { "commentedoncontainer", blogPart.Id } });
|
||||
public static void Register(this IFeedManager feedManager, BlogPart blogPart, string blogTitle) {
|
||||
feedManager.Register(blogTitle, "rss", new RouteValueDictionary { { "containerid", blogPart.Id } });
|
||||
feedManager.Register(blogTitle + " - Comments", "rss", new RouteValueDictionary { { "commentedoncontainer", blogPart.Id } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,22 +1,15 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
|
||||
namespace Orchard.Blogs.Models {
|
||||
public class BlogPart : ContentPart<BlogPartRecord> {
|
||||
|
||||
// TODO: (PH) This isn't referenced in many places but should use ContentItemMetadata instead?
|
||||
public string Name {
|
||||
get { return this.As<ITitleAspect>().Title; }
|
||||
}
|
||||
|
||||
public string Description {
|
||||
get { return Record.Description; }
|
||||
set { Record.Description = value; }
|
||||
get { return Retrieve(x => x.Description); }
|
||||
set { Store(x => x.Description, value); }
|
||||
}
|
||||
|
||||
public int PostCount {
|
||||
get { return Record.PostCount; }
|
||||
set { Record.PostCount = value; }
|
||||
get { return Retrieve(x => x.PostCount); }
|
||||
set { Store(x => x.PostCount, value); }
|
||||
}
|
||||
}
|
||||
}
|
@@ -126,7 +126,6 @@ namespace Orchard.Blogs.Services {
|
||||
_contentManager.Query(versionOptions, "BlogPost")
|
||||
.Join<CommonPartRecord>().Where(
|
||||
cr => cr.Container == blog.Record.ContentItemRecord).OrderByDescending(cr => cr.CreatedUtc)
|
||||
.WithQueryHintsFor("BlogPost")
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@@ -132,7 +132,7 @@ namespace Orchard.Blogs.Services {
|
||||
array.Add(new XRpcStruct()
|
||||
.Set("url", urlHelper.AbsoluteAction(() => urlHelper.Blog(blogPart)))
|
||||
.Set("blogid", blog.Id)
|
||||
.Set("blogName", blog.Name));
|
||||
.Set("blogName", _contentManager.GetItemMetadata(blog).DisplayText));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user