|
|
|
@ -1,22 +1,22 @@ |
|
|
|
using Microsoft.AspNetCore.Html; |
|
|
|
using Microsoft.AspNetCore.Mvc.Rendering; |
|
|
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
using System.Text; |
|
|
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
{ |
|
|
|
public class AbpModalTagHelperService : AbpTagHelperService<AbpModalTagHelper> |
|
|
|
{ |
|
|
|
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) |
|
|
|
{ |
|
|
|
output.TagName = null; |
|
|
|
|
|
|
|
var childContent = await output.GetChildContentAsync(); |
|
|
|
|
|
|
|
SetContent(context, output, childContent); |
|
|
|
} |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
{ |
|
|
|
public class AbpModalTagHelperService : AbpTagHelperService<AbpModalTagHelper> |
|
|
|
{ |
|
|
|
public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) |
|
|
|
{ |
|
|
|
output.TagName = null; |
|
|
|
|
|
|
|
var childContent = await output.GetChildContentAsync(); |
|
|
|
|
|
|
|
SetContent(context, output, childContent); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void SetContent(TagHelperContext context, TagHelperOutput output, TagHelperContent childContent) |
|
|
|
{ |
|
|
|
var modalContent = GetModalContentElement(context, output, childContent); |
|
|
|
@ -24,16 +24,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
var modal = GetModal(context, output, modalDialog); |
|
|
|
|
|
|
|
output.Content.SetHtmlContent(modal); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
protected virtual TagBuilder GetModalContentElement(TagHelperContext context, TagHelperOutput output, TagHelperContent childContent) |
|
|
|
{ |
|
|
|
var element = new TagBuilder("div"); |
|
|
|
element.AddCssClass(GetModalContentClasses()); |
|
|
|
element.InnerHtml.SetHtmlContent(childContent); |
|
|
|
return element; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
protected virtual TagBuilder GetModalDialogElement(TagHelperContext context, TagHelperOutput output, IHtmlContent innerHtml) |
|
|
|
{ |
|
|
|
var element = new TagBuilder("div"); |
|
|
|
@ -41,8 +41,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
element.Attributes.Add("role", "document"); |
|
|
|
element.InnerHtml.SetHtmlContent(innerHtml); |
|
|
|
return element; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
protected virtual TagBuilder GetModal(TagHelperContext context, TagHelperOutput output, IHtmlContent innerHtml) |
|
|
|
{ |
|
|
|
var element = new TagBuilder("div"); |
|
|
|
@ -61,37 +61,37 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
element.InnerHtml.SetHtmlContent(innerHtml); |
|
|
|
|
|
|
|
return element; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetModalClasses() |
|
|
|
{ |
|
|
|
return "modal fade"; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetModalDialogClasses() |
|
|
|
{ |
|
|
|
var classNames = new StringBuilder("modal-dialog"); |
|
|
|
|
|
|
|
if (TagHelper.Centered ?? false) |
|
|
|
{ |
|
|
|
classNames.Append(" "); |
|
|
|
classNames.Append("modal-dialog-centered"); |
|
|
|
} |
|
|
|
|
|
|
|
if (TagHelper.Size != AbpModalSize.Default) |
|
|
|
{ |
|
|
|
classNames.Append(" "); |
|
|
|
classNames.Append(TagHelper.Size.ToClassName()); |
|
|
|
} |
|
|
|
|
|
|
|
return classNames.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetModalContentClasses() |
|
|
|
{ |
|
|
|
return "modal-content"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetModalClasses() |
|
|
|
{ |
|
|
|
return "modal fade"; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetModalDialogClasses() |
|
|
|
{ |
|
|
|
var classNames = new StringBuilder("modal-dialog"); |
|
|
|
|
|
|
|
if (TagHelper.Centered ?? false) |
|
|
|
{ |
|
|
|
classNames.Append(" "); |
|
|
|
classNames.Append("modal-dialog-centered"); |
|
|
|
} |
|
|
|
|
|
|
|
if (TagHelper.Size != AbpModalSize.Default) |
|
|
|
{ |
|
|
|
classNames.Append(" "); |
|
|
|
classNames.Append(TagHelper.Size.ToClassName()); |
|
|
|
} |
|
|
|
|
|
|
|
return classNames.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetModalContentClasses() |
|
|
|
{ |
|
|
|
return "modal-content"; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetDataAttributes() |
|
|
|
{ |
|
|
|
if (TagHelper.Static == true) |
|
|
|
@ -107,6 +107,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|
|
|
{ |
|
|
|
builder.Attributes.Add("data-backdrop", "static"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|