mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 02:44:52 +08:00
Simplifying, removing dead code from blog drivers.
--HG-- branch : dev
This commit is contained in:
@@ -1,37 +1,11 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Blogs.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class BlogPartDriver : ContentPartDriver<BlogPart> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
private readonly IFeedManager _feedManager;
|
||||
|
||||
public BlogPartDriver(
|
||||
IOrchardServices services,
|
||||
IContentManager contentManager,
|
||||
IBlogPostService blogPostService,
|
||||
IFeedManager feedManager) {
|
||||
Services = services;
|
||||
_contentManager = contentManager;
|
||||
_blogPostService = blogPostService;
|
||||
_feedManager = feedManager;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override string Prefix { get { return ""; } }
|
||||
|
||||
protected override DriverResult Display(BlogPart part, string displayType, dynamic shapeHelper) {
|
||||
return Combined(
|
||||
ContentShape("Parts_Blogs_Blog_Manage",
|
||||
@@ -40,24 +14,6 @@ namespace Orchard.Blogs.Drivers {
|
||||
() => shapeHelper.Parts_Blogs_Blog_Description(ContentPart: part, Description: part.Description)),
|
||||
ContentShape("Parts_Blogs_Blog_BlogPostCount",
|
||||
() => shapeHelper.Parts_Blogs_Blog_BlogPostCount(ContentPart: part, PostCount: part.PostCount))
|
||||
//,
|
||||
// todo: (heskew) implement a paging solution that doesn't require blog posts to be tied to the blog within the controller
|
||||
//ContentShape("Parts_Blogs_BlogPost_List",
|
||||
// () => {
|
||||
// _feedManager.Register(part);
|
||||
// var list = shapeHelper.List();
|
||||
// list.AddRange(_blogPostService.Get(part)
|
||||
// .Select(bp => _contentManager.BuildDisplay(bp, "Summary")));
|
||||
// return shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
|
||||
// }),
|
||||
//ContentShape("Parts_Blogs_BlogPost_List_Admin",
|
||||
// () =>
|
||||
// {
|
||||
// var list = shapeHelper.List();
|
||||
// list.AddRange(_blogPostService.Get(part, VersionOptions.Latest)
|
||||
// .Select(bp => _contentManager.BuildDisplay(bp, "SummaryAdmin")));
|
||||
// return shapeHelper.Parts_Blogs_BlogPost_List_Admin(ContentPart: part, ContentItems: list);
|
||||
// })
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -3,24 +3,16 @@ using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Blogs.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class BlogPostPartDriver : ContentPartDriver<BlogPostPart> {
|
||||
private readonly IFeedManager _feedManager;
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
public BlogPostPartDriver(IOrchardServices services, IFeedManager feedManager) {
|
||||
public BlogPostPartDriver(IFeedManager feedManager) {
|
||||
_feedManager = feedManager;
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override string Prefix { get { return ""; } }
|
||||
|
||||
protected override DriverResult Display(BlogPostPart part, string displayType, dynamic shapeHelper) {
|
||||
if (displayType.StartsWith("Detail"))
|
||||
_feedManager.Register(part.BlogPart);
|
||||
|
Reference in New Issue
Block a user