From e95b1a132b79b513d0ec6e1d68d338d10c60a973 Mon Sep 17 00:00:00 2001 From: yekalkan Date: Wed, 16 May 2018 04:52:50 +0300 Subject: [PATCH] Refactoring tag helpers Alerts --- .../TagHelpers/Alert/AbpAlertHeaderTagHelper.cs | 12 ++++++------ .../Alert/AbpAlertHeaderTagHelperService.cs | 1 - .../TagHelpers/Alert/AbpAlertLinkTagHelperService.cs | 1 - .../TagHelpers/Alert/AbpAlertTagHelperService.cs | 4 +--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelper.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelper.cs index 385d34ba57..45c0a667c2 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelper.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelper.cs @@ -2,12 +2,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert { - [HtmlTargetElement("h1", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] - [HtmlTargetElement("h2", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] - [HtmlTargetElement("h3", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] - [HtmlTargetElement("h4", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] - [HtmlTargetElement("h5", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] - [HtmlTargetElement("h6", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("h1", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("h2", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("h3", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("h4", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("h5", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("h6", ParentTag = "abp-alert", TagStructure = TagStructure.NormalOrSelfClosing)] public class AbpAlertHeaderTagHelper : AbpTagHelper { diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelperService.cs index 69bff1995c..1e3b9e7c2a 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelperService.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertHeaderTagHelperService.cs @@ -8,7 +8,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert public override void Process(TagHelperContext context, TagHelperOutput output) { output.Attributes.AddClass("alert-heading"); - output.Attributes.RemoveAll("abp-alert-header"); } } } \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertLinkTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertLinkTagHelperService.cs index 07d9ca73eb..9cf468384b 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertLinkTagHelperService.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertLinkTagHelperService.cs @@ -8,7 +8,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert public override void Process(TagHelperContext context, TagHelperOutput output) { output.Attributes.AddClass("alert-link"); - output.Attributes.RemoveAll("abp-alert-link"); } } diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertTagHelperService.cs index 747bd84c21..a94f7d9ce8 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertTagHelperService.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Alert/AbpAlertTagHelperService.cs @@ -6,14 +6,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert { public class AbpAlertTagHelperService : AbpTagHelperService { - public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; output.TagMode = TagMode.StartTagAndEndTag; AddClasses(context, output); - AddDismissButtonIfDismissible(context, output); } @@ -45,7 +43,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert var buttonAsHtml = ""; + " "; output.PostContent.SetHtmlContent(buttonAsHtml); }