mirror of https://github.com/abpframework/abp.git
2 changed files with 39 additions and 29 deletions
@ -1,35 +1,10 @@ |
|||||
using System.Text; |
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
||||
using Localization.Resources.AbpUi; |
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
||||
using Microsoft.Extensions.Localization; |
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
|
||||
|
|
||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
||||
{ |
{ |
||||
public class AbpModalFooterTagHelper : TagHelper |
public class AbpModalFooterTagHelper : AbpTagHelper<AbpModalFooterTagHelper, AbpModalFooterTagHelperService> |
||||
{ |
{ |
||||
private readonly IStringLocalizer<AbpUiResource> _localizer; |
public AbpModalFooterTagHelper(AbpModalFooterTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
public AbpModalFooterTagHelper(IStringLocalizer<AbpUiResource> localizer) |
|
||||
{ |
{ |
||||
_localizer = localizer; |
|
||||
} |
|
||||
|
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output) |
|
||||
{ |
|
||||
output.TagName = "div"; |
|
||||
output.Attributes.AddClass("modal-footer"); |
|
||||
output.Content.SetHtmlContent(CreateContent()); |
|
||||
} |
|
||||
|
|
||||
private string CreateContent() |
|
||||
{ |
|
||||
var sb = new StringBuilder(); |
|
||||
|
|
||||
sb.AppendLine("<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">" + _localizer["Close"] + "</button>"); |
|
||||
sb.AppendLine("<button type=\"submit\" class=\"btn btn-primary\" data-busy-text=\""+ _localizer["SavingWithThreeDot"] + "\"><i class=\"fa fa-check\"></i> <span>" + _localizer["Save"] + "</span></button>"); |
|
||||
|
|
||||
return sb.ToString(); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using System.Text; |
||||
|
using Localization.Resources.AbpUi; |
||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Microsoft.Extensions.Localization; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
||||
|
{ |
||||
|
public class AbpModalFooterTagHelperService : AbpTagHelperService<AbpModalFooterTagHelper> |
||||
|
{ |
||||
|
private readonly IStringLocalizer<AbpUiResource> _localizer; |
||||
|
|
||||
|
public AbpModalFooterTagHelperService(IStringLocalizer<AbpUiResource> localizer) |
||||
|
{ |
||||
|
_localizer = localizer; |
||||
|
} |
||||
|
|
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "div"; |
||||
|
output.Attributes.AddClass("modal-footer"); |
||||
|
output.Content.SetHtmlContent(CreateContent()); |
||||
|
} |
||||
|
|
||||
|
private string CreateContent() |
||||
|
{ |
||||
|
var sb = new StringBuilder(); |
||||
|
|
||||
|
sb.AppendLine("<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">" + _localizer["Close"] + "</button>"); |
||||
|
sb.AppendLine("<button type=\"submit\" class=\"btn btn-primary\" data-busy-text=\"" + _localizer["SavingWithThreeDot"] + "\"><i class=\"fa fa-check\"></i> <span>" + _localizer["Save"] + "</span></button>"); |
||||
|
|
||||
|
return sb.ToString(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue