mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
- 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:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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" />
|
||||
|
32
src/Orchard.Web/Packages/Orchard.Tags/Routes.cs
Normal file
32
src/Orchard.Web/Packages/Orchard.Tags/Routes.cs
Normal 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())
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user