forked from aspnet/Mvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Rosa
authored and
Chris Rosa
committed
Sep 28, 2016
1 parent
0a4c06e
commit ac744ca
Showing
12 changed files
with
123 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/DictionaryPrefixTestTagHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.AspNetCore.Mvc.Razor.Host.Test | ||
{ | ||
[HtmlTargetElement(Attributes = "prefix-*")] | ||
public class DictionaryPrefixTestTagHelper : TagHelper | ||
{ | ||
[HtmlAttributeName(DictionaryAttributePrefix = "prefix-")] | ||
public IDictionary<string, ModelExpression> PrefixValues { get; set; } = new Dictionary<string, ModelExpression>(); | ||
|
||
public override void Process(TagHelperContext context, TagHelperOutput output) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
.../Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Input/ModelExpressionTagHelper.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
@model DateTime | ||
|
||
@addTagHelper Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper, Microsoft.AspNetCore.Mvc.Razor.Host.Test | ||
@addTagHelper Microsoft.AspNetCore.Mvc.Razor.DictionaryPrefixTestTagHelper, Microsoft.AspNetCore.Mvc.Razor.Host.Test | ||
|
||
<input-test for="Now" /> | ||
<input-test for="@Model" /> | ||
<input-test for="@Model" /> | ||
|
||
<div prefix-test="@Model" ></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
test/WebSites/TagHelpersWebSite/TagHelpers/DictionaryPrefixTestTagHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
|
||
namespace Microsoft.AspNetCore.Mvc.Razor.Host.Test | ||
{ | ||
[HtmlTargetElement(Attributes = "prefix-*")] | ||
public class DictionaryPrefixTestTagHelper : TagHelper | ||
{ | ||
[HtmlAttributeName(DictionaryAttributePrefix = "prefix-")] | ||
public IDictionary<string, ModelExpression> PrefixValues { get; set; } = new Dictionary<string, ModelExpression>(); | ||
|
||
public override void Process(TagHelperContext context, TagHelperOutput output) | ||
{ | ||
var ulTag = new TagBuilder("ul"); | ||
|
||
foreach (var item in PrefixValues) | ||
{ | ||
var liTag = new TagBuilder("li"); | ||
|
||
liTag.InnerHtml.Append(item.Value.Name); | ||
|
||
ulTag.InnerHtml.AppendHtml(liTag); | ||
} | ||
|
||
output.Content.SetHtmlContent(ulTag); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters