mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 11:44:41 +08:00
Backed out changeset: d566877ae7c9
--HG-- branch : 1.x
This commit is contained in:
@@ -58,19 +58,13 @@ namespace Orchard.Blogs.Controllers {
|
||||
return View((object)viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Item(string blogPath, PagerParameters pagerParameters) {
|
||||
public ActionResult Item(int blogId, PagerParameters pagerParameters) {
|
||||
Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
|
||||
|
||||
var correctedPath = _blogPathConstraint.FindPath(blogPath);
|
||||
if (correctedPath == null)
|
||||
var blogPart = _blogService.Get(blogId, VersionOptions.Published).As<BlogPart>();
|
||||
if (blogPart == null)
|
||||
return HttpNotFound();
|
||||
|
||||
var blogPart = _blogService.Get(correctedPath);
|
||||
|
||||
//var blogPart = _blogService.Get(blogId, VersionOptions.Published).As<BlogPart>();
|
||||
//if (blogPart == null)
|
||||
// return HttpNotFound();
|
||||
|
||||
_feedManager.Register(blogPart);
|
||||
var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize)
|
||||
.Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Orchard.Blogs.Handlers {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
{"Controller", "Blog"},
|
||||
{"Action", "Item"},
|
||||
{"blogPath", context.ContentItem.As<IAliasAspect>().Path}
|
||||
{"blogId", context.ContentItem.Id}
|
||||
};
|
||||
context.Metadata.CreateRouteValues = new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
|
||||
@@ -6,15 +6,12 @@ using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Blogs {
|
||||
public class Routes : IRouteProvider {
|
||||
private readonly IBlogPathConstraint _blogPathConstraint;
|
||||
private readonly IArchiveConstraint _archiveConstraint;
|
||||
private readonly IRsdConstraint _rsdConstraint;
|
||||
|
||||
public Routes(
|
||||
IBlogPathConstraint blogPathConstraint,
|
||||
IArchiveConstraint archiveConstraint,
|
||||
IRsdConstraint rsdConstraint) {
|
||||
_blogPathConstraint = blogPathConstraint;
|
||||
_archiveConstraint = archiveConstraint;
|
||||
_rsdConstraint = rsdConstraint;
|
||||
}
|
||||
@@ -180,23 +177,6 @@ namespace Orchard.Blogs {
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
new RouteDescriptor {
|
||||
Priority = 11,
|
||||
Route = new Route(
|
||||
"{*blogPath}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Blogs"},
|
||||
{"controller", "Blog"},
|
||||
{"action", "Item"},
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"blogPath", _blogPathConstraint}
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Blogs"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"{*path}",
|
||||
|
||||
Reference in New Issue
Block a user