Abp Table header theme tag helper

pull/279/head
yekalkan 7 years ago
parent 92a5ff78a8
commit a15a691ec2

@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Table
{
[HtmlTargetElement("thead")]
public class AbpTableHeaderTagHelper : AbpTagHelper<AbpTableHeaderTagHelper, AbpTableHeaderTagHelperService>
{
public AbpTableHeaderTheme Theme { get; set; } = AbpTableHeaderTheme.Default;
public AbpTableHeaderTagHelper(AbpTableHeaderTagHelperService tagHelperService)
: base(tagHelperService)
{
}
}
}

@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Table
{
public class AbpTableHeaderTagHelperService : AbpTagHelperService<AbpTableHeaderTagHelper>
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
SetTheme(context, output);
}
protected virtual void SetTheme(TagHelperContext context, TagHelperOutput output)
{
switch (TagHelper.Theme)
{
case AbpTableHeaderTheme.Default:
return;
case AbpTableHeaderTheme.Dark:
output.Attributes.AddClass("thead-dark");
return;
case AbpTableHeaderTheme.Light:
output.Attributes.AddClass("thead-light");
return;
}
}
}
}

@ -16,7 +16,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Table
SetBorderStyle(context, output); SetBorderStyle(context, output);
SetSmall(context, output); SetSmall(context, output);
SetStripedRows(context, output); SetStripedRows(context, output);
} }
protected virtual void SetResponsiveness(TagHelperContext context, TagHelperOutput output) protected virtual void SetResponsiveness(TagHelperContext context, TagHelperOutput output)

Loading…
Cancel
Save