Add Razor TagHelper for Ooui
You can now use <ooui element="button"/> to embed Ooui in Razor pages. Fixes #63
This commit is contained in:
parent
449abbe4d7
commit
bd802c7d1b
|
@ -0,0 +1,16 @@
|
||||||
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
|
|
||||||
|
namespace Ooui.AspNetCore.TagHelpers
|
||||||
|
{
|
||||||
|
public class OouiTagHelper : TagHelper
|
||||||
|
{
|
||||||
|
public Ooui.Element Element { get; set; }
|
||||||
|
|
||||||
|
public override void Process (TagHelperContext context, TagHelperOutput output)
|
||||||
|
{
|
||||||
|
output.TagName = "div";
|
||||||
|
output.TagMode = TagMode.StartTagAndEndTag;
|
||||||
|
output.Content.SetHtmlContent (Element.OuterHtml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,9 @@
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
<p>© 2017 - @DateTime.UtcNow.Year Frank A. Krueger</p>
|
<p>© 2017 - @DateTime.UtcNow.Year Frank A. Krueger</p>
|
||||||
|
@{ var e = new Ooui.Sa.Button("Hello World"); }
|
||||||
|
<ooui element="e" />
|
||||||
|
<!--Html.Ooui (e)-->
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
@using AspNetCoreMvc.Models
|
@using AspNetCoreMvc.Models
|
||||||
@using AspNetCoreMvc.Controllers
|
@using AspNetCoreMvc.Controllers
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
@addTagHelper *, Ooui.AspNetCore
|
||||||
|
|
Loading…
Reference in New Issue