Backed out changeset: d566877ae7c9

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-02-24 13:01:54 -08:00
parent de2cc815ef
commit 9ba008ec32
3 changed files with 5 additions and 31 deletions

View File

@@ -58,19 +58,13 @@ namespace Orchard.Blogs.Controllers {
return View((object)viewModel); 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); Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
var correctedPath = _blogPathConstraint.FindPath(blogPath); var blogPart = _blogService.Get(blogId, VersionOptions.Published).As<BlogPart>();
if (correctedPath == null) if (blogPart == null)
return HttpNotFound(); return HttpNotFound();
var blogPart = _blogService.Get(correctedPath);
//var blogPart = _blogService.Get(blogId, VersionOptions.Published).As<BlogPart>();
//if (blogPart == null)
// return HttpNotFound();
_feedManager.Register(blogPart); _feedManager.Register(blogPart);
var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize) var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize)
.Select(b => _services.ContentManager.BuildDisplay(b, "Summary")); .Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));

View File

@@ -35,7 +35,7 @@ namespace Orchard.Blogs.Handlers {
{"Area", "Orchard.Blogs"}, {"Area", "Orchard.Blogs"},
{"Controller", "Blog"}, {"Controller", "Blog"},
{"Action", "Item"}, {"Action", "Item"},
{"blogPath", context.ContentItem.As<IAliasAspect>().Path} {"blogId", context.ContentItem.Id}
}; };
context.Metadata.CreateRouteValues = new RouteValueDictionary { context.Metadata.CreateRouteValues = new RouteValueDictionary {
{"Area", "Orchard.Blogs"}, {"Area", "Orchard.Blogs"},

View File

@@ -6,15 +6,12 @@ using Orchard.Mvc.Routes;
namespace Orchard.Blogs { namespace Orchard.Blogs {
public class Routes : IRouteProvider { public class Routes : IRouteProvider {
private readonly IBlogPathConstraint _blogPathConstraint;
private readonly IArchiveConstraint _archiveConstraint; private readonly IArchiveConstraint _archiveConstraint;
private readonly IRsdConstraint _rsdConstraint; private readonly IRsdConstraint _rsdConstraint;
public Routes( public Routes(
IBlogPathConstraint blogPathConstraint,
IArchiveConstraint archiveConstraint, IArchiveConstraint archiveConstraint,
IRsdConstraint rsdConstraint) { IRsdConstraint rsdConstraint) {
_blogPathConstraint = blogPathConstraint;
_archiveConstraint = archiveConstraint; _archiveConstraint = archiveConstraint;
_rsdConstraint = rsdConstraint; _rsdConstraint = rsdConstraint;
} }
@@ -180,24 +177,7 @@ namespace Orchard.Blogs {
}, },
new MvcRouteHandler()) new MvcRouteHandler())
}, },
new RouteDescriptor { 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( Route = new Route(
"{*path}", "{*path}",
new RouteValueDictionary { new RouteValueDictionary {