#17261 Changing BlogSlugConstraint to BlogPathContraint to handle homepage blogs

Work Item: 17261

--HG--
branch : dev
extra : transplant_source : Y%BC%1F%0E%A2%C5%10%BE%3B%82P%21%FC%FA%ED%FE%A7%26%9B%92
This commit is contained in:
Sebastien Ros
2011-01-31 13:25:16 -08:00
parent fc261cdb3a
commit 2680f394ba
15 changed files with 122 additions and 88 deletions

View File

@@ -20,7 +20,7 @@ namespace Orchard.Blogs.Controllers {
private readonly IOrchardServices _services;
private readonly IBlogService _blogService;
private readonly IBlogPostService _blogPostService;
private readonly IBlogSlugConstraint _blogSlugConstraint;
private readonly IBlogPathConstraint _blogPathConstraint;
private readonly IFeedManager _feedManager;
private readonly IWorkContextAccessor _workContextAccessor;
private readonly IHomePageProvider _routableHomePageProvider;
@@ -30,7 +30,7 @@ namespace Orchard.Blogs.Controllers {
IOrchardServices services,
IBlogService blogService,
IBlogPostService blogPostService,
IBlogSlugConstraint blogSlugConstraint,
IBlogPathConstraint blogPathConstraint,
IFeedManager feedManager,
IShapeFactory shapeFactory,
IWorkContextAccessor workContextAccessor,
@@ -39,7 +39,7 @@ namespace Orchard.Blogs.Controllers {
_services = services;
_blogService = blogService;
_blogPostService = blogPostService;
_blogSlugConstraint = blogSlugConstraint;
_blogPathConstraint = blogPathConstraint;
_feedManager = feedManager;
_workContextAccessor = workContextAccessor;
_siteService = siteService;
@@ -64,13 +64,13 @@ namespace Orchard.Blogs.Controllers {
return View((object)viewModel);
}
public ActionResult Item(string blogSlug, PagerParameters pagerParameters) {
public ActionResult Item(string blogPath, PagerParameters pagerParameters) {
Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
var correctedSlug = _blogSlugConstraint.FindSlug(blogSlug);
if (correctedSlug == null)
var correctedPath = _blogPathConstraint.FindPath(blogPath);
if (correctedPath == null)
return HttpNotFound();
var blogPart = _blogService.Get(correctedSlug);
var blogPart = _blogService.Get(correctedPath);
if (blogPart == null)
return HttpNotFound();