- Add route descriptors for the tags module so the front end urls are user-friendly. /Tags will get you the tag cloud, /Tags/<Tagname> will get you the content items tagged by <Tagname>

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042253
This commit is contained in:
suhacan
2009-11-25 23:20:19 +00:00
parent 803e07fc74
commit bc814e566f
3 changed files with 34 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ namespace Orchard.Tags.Controllers {
}
catch (Exception exception) {
_notifier.Error(T("Retrieving tagged items failed: " + exception.Message));
return Index();
return RedirectToAction("Index");
}
}
}

View File

@@ -69,6 +69,7 @@
<Compile Include="Models\TagsHandler.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routes.cs" />
<Compile Include="Services\TagService.cs" />
<Compile Include="ViewModels\TagsAdminCreateViewModel.cs" />
<Compile Include="ViewModels\TagsAdminEditViewModel.cs" />

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Mvc.Routes;
namespace Orchard.Tags {
public class Routes : IRouteProvider {
public void GetRoutes(ICollection<RouteDescriptor> routes) {
foreach (var routeDescriptor in GetRoutes())
routes.Add(routeDescriptor);
}
public IEnumerable<RouteDescriptor> GetRoutes() {
return new[] {
new RouteDescriptor { Priority = 5,
Route = new Route(
"Tags/{tagName}",
new RouteValueDictionary {
{"area", "Orchard.Tags"},
{"controller", "Home"},
{"action", "Search"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "Orchard.Tags"}
},
new MvcRouteHandler())
}
};
}
}
}