mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
Fix tokens for tag patterns
--HG-- branch : autoroute rename : src/Orchard.Web/Modules/Orchard.Tags/Providers/TagTokenProvider.cs => src/Orchard.Web/Modules/Orchard.Tags/Providers/TagTokens.cs
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Projections\TagsFilterForms.cs" />
|
<Compile Include="Projections\TagsFilterForms.cs" />
|
||||||
<Compile Include="Providers\TagPatterns.cs" />
|
<Compile Include="Providers\TagPatterns.cs" />
|
||||||
<Compile Include="Providers\TagTokenProvider.cs" />
|
<Compile Include="Providers\TagTokens.cs" />
|
||||||
<Compile Include="ResourceManifest.cs" />
|
<Compile Include="ResourceManifest.cs" />
|
||||||
<Compile Include="Services\ITagService.cs" />
|
<Compile Include="Services\ITagService.cs" />
|
||||||
<Compile Include="Services\XmlRpcHandler.cs" />
|
<Compile Include="Services\XmlRpcHandler.cs" />
|
||||||
|
|||||||
@@ -32,4 +32,3 @@ using System.Security;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("1.3.0")]
|
[assembly: AssemblyVersion("1.3.0")]
|
||||||
[assembly: AssemblyFileVersion("1.3.0")]
|
[assembly: AssemblyFileVersion("1.3.0")]
|
||||||
[assembly: SecurityTransparent]
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Orchard.Tags.Providers {
|
|||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
public void Describe(dynamic describe) {
|
public void Describe(dynamic describe) {
|
||||||
describe.For<TagRecord>("Tags", T("Tags"), T("Tags url patterns"), (Func<TagRecord, string>)GetId, (Func<string, TagRecord>)GetTag)
|
describe.For<TagRecord>("Tags", T("Tags"), T("Tags url patterns"), (Func<TagRecord, string>)GetId, (Func<string, TagRecord>)GetTag, (Func<TagRecord, IDictionary<string, object>>)GetContext)
|
||||||
.Pattern("Tags", T("View all tags"), T("A list of all tags are displayed on this page"), (Func<TagRecord, RouteValueDictionary>)GetTagsRouteValues)
|
.Pattern("Tags", T("View all tags"), T("A list of all tags are displayed on this page"), (Func<TagRecord, RouteValueDictionary>)GetTagsRouteValues)
|
||||||
.Pattern("View", T("View tagged content"), T("Tagged content will be listed on this Url for each tag"), (Func<TagRecord, RouteValueDictionary>)GetRouteValues);
|
.Pattern("View", T("View tagged content"), T("Tagged content will be listed on this Url for each tag"), (Func<TagRecord, RouteValueDictionary>)GetRouteValues);
|
||||||
}
|
}
|
||||||
@@ -50,6 +50,10 @@ namespace Orchard.Tags.Providers {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDictionary<string,object> GetContext(TagRecord tag) {
|
||||||
|
return new Dictionary<string, object> { { "Tag", tag } };
|
||||||
|
}
|
||||||
|
|
||||||
public string GetId(TagRecord tag) {
|
public string GetId(TagRecord tag) {
|
||||||
return tag.Id.ToString();
|
return tag.Id.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ using Orchard.Localization;
|
|||||||
using Orchard.Tags.Models;
|
using Orchard.Tags.Models;
|
||||||
|
|
||||||
namespace Orchard.Tags.Providers {
|
namespace Orchard.Tags.Providers {
|
||||||
public class TagTokenProvider : ITokenProvider {
|
public class TagTokens : ITokenProvider {
|
||||||
|
|
||||||
public TagTokenProvider() {
|
public TagTokens() {
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ namespace Orchard.Tags.Providers {
|
|||||||
|
|
||||||
public void Evaluate(EvaluateContext context) {
|
public void Evaluate(EvaluateContext context) {
|
||||||
context.For<TagRecord>("Tag")
|
context.For<TagRecord>("Tag")
|
||||||
|
.Token("", t => t.TagName)
|
||||||
.Token("Name", t => t.TagName)
|
.Token("Name", t => t.TagName)
|
||||||
// By chaining the name to text it can be slugified in Autoroute
|
// By chaining the name to text it can be slugified in Autoroute
|
||||||
.Chain("Name", "Text", t => t.TagName);
|
.Chain("Name", "Text", t => t.TagName);
|
||||||
Reference in New Issue
Block a user