mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 01:57:55 +08:00
Fixed up the url for blog pages and hooked up IsBlogConstraint for the new url.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041739
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Blogs {
|
||||
public class Routes : IRouteProvider
|
||||
{
|
||||
private readonly IBlogService _blogService;
|
||||
|
||||
public Routes(IBlogService blogService) {
|
||||
_blogService = blogService;
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
@@ -27,22 +35,22 @@ namespace Orchard.Blogs {
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
//new RouteDescriptor {
|
||||
// Route = new Route(
|
||||
// "{blogSlug}",
|
||||
// new RouteValueDictionary {
|
||||
// {"area", "Orchard.Blogs"},
|
||||
// {"controller", "Blog"},
|
||||
// {"action", "Item"}
|
||||
// },
|
||||
// new RouteValueDictionary()/* {
|
||||
// {"blogSlug", new IsBlogConstraint()}
|
||||
// }*/,
|
||||
// new RouteValueDictionary {
|
||||
// {"area", "Orchard.Blogs"}
|
||||
// },
|
||||
// new MvcRouteHandler())
|
||||
// }
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"{blogSlug}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Blogs"},
|
||||
{"controller", "Blog"},
|
||||
{"action", "Item"}
|
||||
},
|
||||
new RouteValueDictionary() {
|
||||
{"blogSlug", new IsBlogConstraint(_blogService)}
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Blogs"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user