Merge pull request #2113 from bolatovumar/feat/add-pull-payment-css

Add ability to add custom CSS to pull payments
This commit is contained in:
Nicolas Dorier 2020-12-09 21:33:16 +09:00 committed by GitHub
commit c8a9b66694
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 6 deletions

View file

@ -30,7 +30,9 @@ namespace BTCPayServer.Controllers
return View(new NewPullPaymentModel()
{
Name = "",
Currency = "BTC"
Currency = "BTC",
CustomCSSLink = "",
EmbeddedCSS = "",
});
}
@ -65,7 +67,9 @@ namespace BTCPayServer.Controllers
Amount = model.Amount,
Currency = model.Currency,
StoreId = walletId.StoreId,
PaymentMethodIds = new[] { paymentMethodId }
PaymentMethodIds = new[] { paymentMethodId },
EmbeddedCSS = model.EmbeddedCSS,
CustomCSSLink = model.CustomCSSLink
});
this.TempData.SetStatusMessageModel(new StatusMessageModel()
{

View file

@ -29,6 +29,8 @@ namespace BTCPayServer.HostedServices
public string Name { get; set; }
public decimal Amount { get; set; }
public string Currency { get; set; }
public string CustomCSSLink { get; set; }
public string EmbeddedCSS { get; set; }
public PaymentMethodId[] PaymentMethodIds { get; set; }
public TimeSpan? Period { get; set; }
}
@ -110,9 +112,9 @@ namespace BTCPayServer.HostedServices
{
Title = create.Name ?? string.Empty,
Description = string.Empty,
CustomCSSLink = null,
CustomCSSLink = create.CustomCSSLink,
Email = null,
EmbeddedCSS = null,
EmbeddedCSS = create.EmbeddedCSS,
}
});
ctx.PullPayments.Add(o);

View file

@ -42,5 +42,10 @@ namespace BTCPayServer.Models.WalletViewModels
[Required]
[ReadOnly(true)]
public string Currency { get; set; }
[MaxLength(500)]
[Display(Name = "Custom bootstrap CSS file")]
public string CustomCSSLink { get; set; }
[Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; }
}
}

View file

@ -1,8 +1,7 @@
@model NewPullPaymentModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData["Title"] = "Manage pull payments";
ViewData.SetActivePageAndTitle(WalletsNavPages.PullPayments);
ViewData["Title"] = "New pull payment";
}
<style type="text/css">
.smMaxWidth {
@ -79,6 +78,19 @@
<span asp-validation-for="Currency" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="CustomCSSLink" class="control-label"></label>
<a href="https://docs.btcpayserver.org/Theme/#2-bootstrap-themes" target="_blank">
<span class="fa fa-question-circle-o" title="More information..."></span>
</a>
<input asp-for="CustomCSSLink" class="form-control" />
<span asp-validation-for="CustomCSSLink" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EmbeddedCSS" class="control-label"></label>
<textarea asp-for="EmbeddedCSS" rows="10" cols="40" class="form-control"></textarea>
<span asp-validation-for="EmbeddedCSS" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" id="Create" />
</div>