|
|
|
@ -1,63 +1,63 @@ |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
using Microsoft.AspNetCore.Mvc.Rendering; |
|
|
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using System.Text; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
|
|
|
|
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"); |
|
|
|
|
|
|
|
if (TagHelper.Buttons != AbpModalButtons.None) |
|
|
|
{ |
|
|
|
output.PostContent.SetHtmlContent(CreateContent()); |
|
|
|
} |
|
|
|
|
|
|
|
ProcessButtonsAlignment(output); |
|
|
|
{ |
|
|
|
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"); |
|
|
|
|
|
|
|
if (TagHelper.Buttons != AbpModalButtons.None) |
|
|
|
{ |
|
|
|
output.PostContent.SetHtmlContent(CreateContent()); |
|
|
|
} |
|
|
|
|
|
|
|
ProcessButtonsAlignment(output); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string CreateContent() |
|
|
|
protected virtual string CreateContent() |
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
|
|
|
|
switch (TagHelper.Buttons) |
|
|
|
switch (TagHelper.Buttons) |
|
|
|
{ |
|
|
|
case AbpModalButtons.Cancel: |
|
|
|
sb.AppendLine(GetCancelButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Close: |
|
|
|
sb.AppendLine(GetCloseButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Save: |
|
|
|
sb.AppendLine(GetSaveButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Save | AbpModalButtons.Cancel: |
|
|
|
sb.AppendLine(GetSaveButton()); |
|
|
|
sb.AppendLine(GetCancelButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Save | AbpModalButtons.Close: |
|
|
|
sb.AppendLine(GetSaveButton()); |
|
|
|
sb.AppendLine(GetCloseButton()); |
|
|
|
case AbpModalButtons.Cancel: |
|
|
|
sb.AppendLine(GetCancelButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Close: |
|
|
|
sb.AppendLine(GetCloseButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Save: |
|
|
|
sb.AppendLine(GetSaveButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Save | AbpModalButtons.Cancel: |
|
|
|
sb.AppendLine(GetSaveButton()); |
|
|
|
sb.AppendLine(GetCancelButton()); |
|
|
|
break; |
|
|
|
case AbpModalButtons.Save | AbpModalButtons.Close: |
|
|
|
sb.AppendLine(GetSaveButton()); |
|
|
|
sb.AppendLine(GetCloseButton()); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
return sb.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetSaveButton() |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetSaveButton() |
|
|
|
{ |
|
|
|
var icon = new TagBuilder("i"); |
|
|
|
icon.AddCssClass("fa"); |
|
|
|
@ -74,10 +74,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
element.InnerHtml.AppendHtml(icon); |
|
|
|
element.InnerHtml.AppendHtml(span); |
|
|
|
|
|
|
|
return RenderHtml(element); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetCloseButton() |
|
|
|
return element.ToHtmlString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetCloseButton() |
|
|
|
{ |
|
|
|
var element = new TagBuilder("button"); |
|
|
|
element.Attributes.Add("type", "button"); |
|
|
|
@ -86,10 +86,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
element.AddCssClass("btn-secondary"); |
|
|
|
element.InnerHtml.Append(_localizer["Close"]); |
|
|
|
|
|
|
|
return RenderHtml(element); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetCancelButton() |
|
|
|
return element.ToHtmlString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetCancelButton() |
|
|
|
{ |
|
|
|
var element = new TagBuilder("button"); |
|
|
|
element.Attributes.Add("type", "button"); |
|
|
|
@ -98,9 +98,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
element.AddCssClass("btn-secondary"); |
|
|
|
element.InnerHtml.Append(_localizer["Cancel"]); |
|
|
|
|
|
|
|
return RenderHtml(element); |
|
|
|
} |
|
|
|
|
|
|
|
return element.ToHtmlString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void ProcessButtonsAlignment(TagHelperOutput output) |
|
|
|
{ |
|
|
|
if (TagHelper.ButtonAlignment == ButtonsAlign.Default) |
|
|
|
@ -108,6 +108,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
return; |
|
|
|
} |
|
|
|
output.Attributes.AddClass("justify-content-" + TagHelper.ButtonAlignment.ToString().ToLowerInvariant()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|