Removing extra setting, depending on Custom CSS for bundled themes

This commit is contained in:
rockstardev
2020-03-28 14:10:18 -06:00
parent fdad5a47d5
commit ee0ef2881a
8 changed files with 27 additions and 32 deletions

View File

@@ -234,7 +234,6 @@ namespace BTCPayServer.Controllers
CustomCSSLink = storeBlob.CustomCSS,
CustomLogoLink = storeBlob.CustomLogo,
HtmlTitle = storeBlob.HtmlTitle ?? "BTCPay Invoice",
CheckoutTheme = storeBlob.CheckoutTheme ?? "Default",
CryptoImage = Request.GetRelativePathOrAbsolute(paymentMethodHandler.GetCryptoImage(paymentMethodId)),
BtcAddress = paymentMethodDetails.GetPaymentDestination(),
BtcDue = accounting.Due.ToString(),

View File

@@ -373,8 +373,6 @@ namespace BTCPayServer.Controllers
vm.CustomCSS = storeBlob.CustomCSS;
vm.CustomLogo = storeBlob.CustomLogo;
vm.HtmlTitle = storeBlob.HtmlTitle;
vm.SetCheckoutThemes(storeBlob.CheckoutTheme);
vm.CheckoutTheme = storeBlob.CheckoutTheme;
vm.SetLanguages(_LangService, storeBlob.DefaultLang);
vm.RequiresRefundEmail = storeBlob.RequiresRefundEmail;
vm.ShowRecommendedFee = storeBlob.ShowRecommendedFee;
@@ -430,13 +428,11 @@ namespace BTCPayServer.Controllers
if (!ModelState.IsValid)
{
model.SetCheckoutThemes(blob.CheckoutTheme);
return View(model);
}
blob.CustomLogo = model.CustomLogo;
blob.CustomCSS = model.CustomCSS;
blob.HtmlTitle = string.IsNullOrWhiteSpace(model.HtmlTitle) ? null : model.HtmlTitle;
blob.CheckoutTheme = model.CheckoutTheme;
blob.DefaultLang = model.DefaultLang;
blob.RequiresRefundEmail = model.RequiresRefundEmail;
blob.ShowRecommendedFee = model.ShowRecommendedFee;

View File

@@ -96,7 +96,6 @@ namespace BTCPayServer.Data
public string CustomCSS { get; set; }
public string CustomLogo { get; set; }
public string HtmlTitle { get; set; }
public string CheckoutTheme { get; set; }
public bool RateScripting { get; set; }

View File

@@ -27,7 +27,6 @@ namespace BTCPayServer.Models.InvoicingModels
public string CustomCSSLink { get; set; }
public string CustomLogoLink { get; set; }
public string HtmlTitle { get; set; }
public string CheckoutTheme { get; set; }
public string DefaultLang { get; set; }
public bool LightningAmountInSatoshi { get; set; }
public List<AvailableCrypto> AvailableCryptos { get; set; } = new List<AvailableCrypto>();

View File

@@ -30,21 +30,6 @@ namespace BTCPayServer.Models.StoreViewModels
}
public SelectList Languages { get; set; }
public SelectList ListCheckoutThemes { get; set; }
public void SetCheckoutThemes(string dbtheme)
{
var list = new List<string>
{
"Default",
"Legacy"
};
if (!list.Any(a => a == dbtheme))
dbtheme = "Default"; // select default if not present
ListCheckoutThemes = new SelectList(list);
CheckoutTheme = dbtheme;
}
[Display(Name = "Default payment method on checkout")]
public string DefaultPaymentMethod { get; set; }
[Display(Name = "Default language on checkout")]
@@ -58,9 +43,6 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Custom HTML title to display on Checkout page")]
public string HtmlTitle { get; set; }
[Display(Name = "Theme used on Checkout page")]
public string CheckoutTheme { get; set; }
[Display(Name = "Requires a refund email")]
public bool RequiresRefundEmail { get; set; }

View File

@@ -24,8 +24,6 @@
<bundle name="wwwroot/bundles/checkout-bundle.min.js" />
<script>vex.defaultOptions.className = 'vex-theme-btcpay'</script>
<link href="/checkout/css/themes/@(Model.CheckoutTheme.ToLower()).css" rel="stylesheet" />
@if (!string.IsNullOrEmpty(Model.CustomCSSLink))
{
<link href="@Model.CustomCSSLink" rel="stylesheet" />

View File

@@ -25,16 +25,27 @@
<a href="https://docs.btcpayserver.org/development/theme#checkout-page-theme" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
<input asp-for="CustomCSS" class="form-control" />
<span asp-validation-for="CustomCSS" class="text-danger"></span>
<p class="form-text text-muted">
Bundled Themes:
<a href="#" onclick="return setTheme(1);">Legacy</a>
@* | <a href="#" onclick="return setTheme(0);">Default</a>*@
</p>
<script type="text/javascript">
function setTheme(themeChoice) {
if (themeChoice === 1) { // reserving 0 for potential clear down the road
$('#CustomCSS').val('/checkout/css/themes/legacy.css');
} else {
$('#CustomCSS').val('');
}
return false;
}
</script>
</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">
<label asp-for="CheckoutTheme"></label>
<select asp-for="CheckoutTheme" asp-items="Model.ListCheckoutThemes" class="form-control"></select>
</div>
<div class="form-group">
<label asp-for="DefaultPaymentMethod"></label>
<select asp-for="DefaultPaymentMethod" asp-items="Model.CryptoCurrencies" class="form-control"></select>

View File

@@ -8311,7 +8311,17 @@ strong {
margin-top: 10px;
}
.header__icon__img {
/* centering for new default design */
.top-header .header__iconcentered {
display: inline-block;
vertical-align: middle;
position: relative;
width: 100px;
height: 50px;
margin: 10px auto 0px;
}
.header__iconcentered__img {
display: block;
-moz-box-sizing: border-box;
box-sizing: border-box;
@@ -8321,6 +8331,7 @@ strong {
height: 40px;
padding-left: 92.5px; /* Must be equal to width */
}
/* eof */
.top-header .timer-row {
background: #CEDC21;