Refactoring tag helpers

Alerts
pull/279/head
yekalkan 7 years ago
parent 9c5ca48219
commit e95b1a132b

@ -2,12 +2,12 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert
{ {
[HtmlTargetElement("h1", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("h1", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)]
[HtmlTargetElement("h2", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("h2", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)]
[HtmlTargetElement("h3", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("h3", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)]
[HtmlTargetElement("h4", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("h4", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)]
[HtmlTargetElement("h5", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("h5", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)]
[HtmlTargetElement("h6", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("h6", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)]
public class AbpAlertHeaderTagHelper : AbpTagHelper<AbpAlertHeaderTagHelper, AbpAlertHeaderTagHelperService> public class AbpAlertHeaderTagHelper : AbpTagHelper<AbpAlertHeaderTagHelper, AbpAlertHeaderTagHelperService>
{ {

@ -8,7 +8,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
output.Attributes.AddClass("alert-heading"); output.Attributes.AddClass("alert-heading");
output.Attributes.RemoveAll("abp-alert-header");
} }
} }
} }

@ -8,7 +8,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
output.Attributes.AddClass("alert-link"); output.Attributes.AddClass("alert-link");
output.Attributes.RemoveAll("abp-alert-link");
} }
} }

@ -6,14 +6,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert
{ {
public class AbpAlertTagHelperService : AbpTagHelperService<AbpAlertTagHelper> public class AbpAlertTagHelperService : AbpTagHelperService<AbpAlertTagHelper>
{ {
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
output.TagName = "div"; output.TagName = "div";
output.TagMode = TagMode.StartTagAndEndTag; output.TagMode = TagMode.StartTagAndEndTag;
AddClasses(context, output); AddClasses(context, output);
AddDismissButtonIfDismissible(context, output); AddDismissButtonIfDismissible(context, output);
} }
@ -45,7 +43,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert
var buttonAsHtml = var buttonAsHtml =
"<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" + Environment.NewLine + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" + Environment.NewLine +
" <span aria-hidden=\"true\">&times;</span>" + Environment.NewLine + " <span aria-hidden=\"true\">&times;</span>" + Environment.NewLine +
" </button>"; " </button>";
output.PostContent.SetHtmlContent(buttonAsHtml); output.PostContent.SetHtmlContent(buttonAsHtml);
} }

Loading…
Cancel
Save