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:
ErikPorter
2009-11-22 07:52:02 +00:00
parent 75340abdcc
commit 038a38e958

View File

@@ -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())
}
};
}
}