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:
Frank A. Krueger 2018-02-02 22:43:55 -08:00
parent 449abbe4d7
commit bd802c7d1b
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
3 changed files with 20 additions and 0 deletions

View File

@ -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);
}
}
}

View File

@ -41,6 +41,9 @@
<hr /> <hr />
<footer> <footer>
<p>&copy; 2017 - @DateTime.UtcNow.Year Frank A. Krueger</p> <p>&copy; 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>

View File

@ -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