Allowing custom HtmlTitle

Fix #96
This commit is contained in:
rockstardev
2018-05-03 16:51:04 -05:00
parent 674cd1486d
commit 0a449e1e8e
7 changed files with 15 additions and 1 deletions

View File

@@ -228,6 +228,7 @@ namespace BTCPayServer.Controllers
OrderId = invoice.OrderId, OrderId = invoice.OrderId,
InvoiceId = invoice.Id, InvoiceId = invoice.Id,
DefaultLang = storeBlob.DefaultLang ?? "en-US", DefaultLang = storeBlob.DefaultLang ?? "en-US",
HtmlTitle = storeBlob.HtmlTitle ?? "BTCPay Invoice",
CustomCSSLink = storeBlob.CustomCSS?.AbsoluteUri, CustomCSSLink = storeBlob.CustomCSS?.AbsoluteUri,
CustomLogoLink = storeBlob.CustomLogo?.AbsoluteUri, CustomLogoLink = storeBlob.CustomLogo?.AbsoluteUri,
BtcAddress = paymentMethodDetails.GetPaymentDestination(), BtcAddress = paymentMethodDetails.GetPaymentDestination(),

View File

@@ -347,6 +347,7 @@ namespace BTCPayServer.Controllers
vm.RequiresRefundEmail = storeBlob.RequiresRefundEmail; vm.RequiresRefundEmail = storeBlob.RequiresRefundEmail;
vm.CustomCSS = storeBlob.CustomCSS?.AbsoluteUri; vm.CustomCSS = storeBlob.CustomCSS?.AbsoluteUri;
vm.CustomLogo = storeBlob.CustomLogo?.AbsoluteUri; vm.CustomLogo = storeBlob.CustomLogo?.AbsoluteUri;
vm.HtmlTitle = storeBlob.HtmlTitle;
return View(vm); return View(vm);
} }
@@ -392,6 +393,7 @@ namespace BTCPayServer.Controllers
blob.OnChainMinValue = onchainMinValue; blob.OnChainMinValue = onchainMinValue;
blob.CustomLogo = string.IsNullOrWhiteSpace(model.CustomLogo) ? null : new Uri(model.CustomLogo, UriKind.Absolute); blob.CustomLogo = string.IsNullOrWhiteSpace(model.CustomLogo) ? null : new Uri(model.CustomLogo, UriKind.Absolute);
blob.CustomCSS = string.IsNullOrWhiteSpace(model.CustomCSS) ? null : new Uri(model.CustomCSS, UriKind.Absolute); blob.CustomCSS = string.IsNullOrWhiteSpace(model.CustomCSS) ? null : new Uri(model.CustomCSS, UriKind.Absolute);
blob.HtmlTitle = string.IsNullOrWhiteSpace(model.HtmlTitle) ? null : model.HtmlTitle;
if (StoreData.SetStoreBlob(blob)) if (StoreData.SetStoreBlob(blob))
{ {
needUpdate = true; needUpdate = true;

View File

@@ -306,6 +306,7 @@ namespace BTCPayServer.Data
public Uri CustomLogo { get; set; } public Uri CustomLogo { get; set; }
[JsonConverter(typeof(UriJsonConverter))] [JsonConverter(typeof(UriJsonConverter))]
public Uri CustomCSS { get; set; } public Uri CustomCSS { get; set; }
public string HtmlTitle { get; set; }
public bool RateScripting { get; set; } public bool RateScripting { get; set; }

View File

@@ -13,6 +13,7 @@ namespace BTCPayServer.Models.InvoicingModels
public string CryptoImage { get; set; } public string CryptoImage { get; set; }
public string Link { get; set; } public string Link { get; set; }
} }
public string HtmlTitle { get; set; }
public string CustomCSSLink { get; set; } public string CustomCSSLink { get; set; }
public string CustomLogoLink { get; set; } public string CustomLogoLink { get; set; }
public string DefaultLang { get; set; } public string DefaultLang { get; set; }

View File

@@ -48,6 +48,10 @@ namespace BTCPayServer.Models.StoreViewModels
[Url] [Url]
public string CustomLogo { get; set; } public string CustomLogo { get; set; }
[Display(Name = "Custom HTML title to display on Checkout page")]
public string HtmlTitle { get; set; }
public void SetCryptoCurrencies(ExplorerClientProvider explorerProvider, string defaultCrypto) public void SetCryptoCurrencies(ExplorerClientProvider explorerProvider, string defaultCrypto)
{ {
var choices = explorerProvider.GetAll().Select(o => new Format() { Name = o.Item1.CryptoCode, Value = o.Item1.CryptoCode }).ToArray(); var choices = explorerProvider.GetAll().Select(o => new Format() { Name = o.Item1.CryptoCode, Value = o.Item1.CryptoCode }).ToArray();

View File

@@ -11,7 +11,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>BTCPay Invoice</title> <title>@Model.HtmlTitle</title>
<bundle name="wwwroot/bundles/checkout-bundle.min.css" /> <bundle name="wwwroot/bundles/checkout-bundle.min.css" />

View File

@@ -26,6 +26,11 @@
<input asp-for="CustomCSS" class="form-control" /> <input asp-for="CustomCSS" class="form-control" />
<span asp-validation-for="CustomCSS" class="text-danger"></span> <span asp-validation-for="CustomCSS" class="text-danger"></span>
</div> </div>
<div class="form-group">
<label asp-for="HtmlTitle"></label>
<input asp-for="HtmlTitle" class="form-control" />
<span asp-validation-for="HtmlTitle" class="text-danger"></span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="DefaultCryptoCurrency"></label> <label asp-for="DefaultCryptoCurrency"></label>
<select asp-for="DefaultCryptoCurrency" asp-items="Model.CryptoCurrencies" class="form-control"></select> <select asp-for="DefaultCryptoCurrency" asp-items="Model.CryptoCurrencies" class="form-control"></select>