Files
btcpayserver/BTCPayServer/Views/Shared/ConfirmModal.cshtml
2025-05-08 19:05:55 +09:00

63 lines
2.4 KiB
Plaintext

@model BTCPayServer.Abstractions.Models.ConfirmModel
@inject LinkGenerator linkGenerator
@{
string actionUrl = null;
if (Model.ActionName is not null)
{
var controllerName = Model.ControllerName ?? ((Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor)Url.ActionContext.ActionDescriptor).ControllerName;
actionUrl = linkGenerator.GetPathByAction(Model.ActionName, controllerName, pathBase: Context.Request.PathBase);
}
}
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="@Html.Id("ConfirmTitle")">@Model.Title</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@StringLocalizer["Close"]">
<vc:icon symbol="close" />
</button>
</div>
<div class="modal-body">
<div id="@Html.Id("ConfirmDescription")">
@if (Model.DescriptionHtml)
{
@Safe.Raw(Model.Description)
}
else
{
@Model.Description
}
</div>
</div>
@if (!string.IsNullOrEmpty(Model.Action))
{
@if (Model.GenerateForm)
{
<form id="@Html.Id("ConfirmForm")" method="post" action="@Url.EnsureLocal(actionUrl, Context.Request)" rel="noreferrer noopener">
@{ ModalContent(); }
</form>
}
else
{
ModalContent();
}
@functions{
void ModalContent()
{
<div class="modal-body pt-0" id="@Html.Id("ConfirmText")" hidden>
<label for="@Html.Id("ConfirmInput")" class="form-label">Confirm the action by typing <strong id="@Html.Id("ConfirmInputText")"></strong>:</label>
<input id="@Html.Id("ConfirmInput")" class="form-control"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary only-for-js" data-bs-dismiss="modal" id="@Html.Id("ConfirmCancel")">Cancel</button>
<button type="submit" class="btn modal-confirm @Model.ButtonClass" id="@Html.Id("ConfirmContinue")">@Model.Action</button>
</div>
}
}
}
</div>
</div>