This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Issue #5310
- Loading branch information
Showing
10 changed files
with
193 additions
and
47 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
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
|
||
namespace Microsoft.AspNetCore.Mvc.Razor | ||
{ | ||
[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
6 changes: 5 additions & 1 deletion
6
.../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,10 @@ | ||
@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> | ||
<span prefix-hour="Hour" prefix-minute="Minute"></span> |
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
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
|
||
namespace TagHelpersWebSite.TagHelpers | ||
{ | ||
[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); | ||
} | ||
} | ||
} |
Oops, something went wrong.