Rename "hidden" to "unavailable"

This commit is contained in:
Umar Bolatov 2021-09-06 13:09:22 -07:00 committed by Andrew Camilleri
parent 403820cf14
commit c267cf0e9c
6 changed files with 18 additions and 18 deletions

View File

@ -21,7 +21,7 @@ namespace BTCPayServer.Models.AppViewModels
public string BuyButtonText { get; set; }
public int? Inventory { get; set; } = null;
public string[] PaymentMethods { get; set; }
public bool Hidden { get; set; } = false;
public bool Unavailable { get; set; } = false;
}
public class CurrencyInfoData

View File

@ -290,7 +290,7 @@ namespace BTCPayServer.Services.Apps
itemNode.Add("image", new YamlScalarNode(item.Image));
}
itemNode.Add("custom", new YamlScalarNode(item.Custom.ToStringLowerInvariant()));
itemNode.Add("hidden", new YamlScalarNode(item.Hidden.ToStringLowerInvariant()));
itemNode.Add("unavailable", new YamlScalarNode(item.Unavailable.ToStringLowerInvariant()));
if (item.Inventory.HasValue)
{
itemNode.Add("inventory", new YamlScalarNode(item.Inventory.ToString()));
@ -339,7 +339,7 @@ namespace BTCPayServer.Services.Apps
BuyButtonText = c.GetDetailString("buyButtonText"),
Inventory = string.IsNullOrEmpty(c.GetDetailString("inventory")) ? (int?)null : int.Parse(c.GetDetailString("inventory"), CultureInfo.InvariantCulture),
PaymentMethods = c.GetDetailStringList("payment_methods"),
Hidden = c.GetDetailString("hidden") == "true"
Unavailable = c.GetDetailString("unavailable") == "true"
})
.ToArray();
}

View File

@ -96,8 +96,8 @@
<input type="text" id="BuyButtonText" class="form-control mb-2" v-model="editingItem.buyButtonText" ref="txtBuyButtonText" />
</div>
<div class="form-group d-flex align-items-center">
<input type="checkbox" id="Hidden" class="btcpay-toggle me-2" v-model="editingItem.hidden" ref="txtHiddenText" />
<label class="form-label mb-0">Hidden</label>
<input type="checkbox" id="Unavailable" class="btcpay-toggle me-2" v-model="editingItem.unavailable" />
<label class="form-label mb-0">Unavailable</label>
</div>
</div>
</div>
@ -172,7 +172,7 @@ document.addEventListener("DOMContentLoaded", function () {
var line = lines[kl], product = line.split("\n"), goingThroughMethods = false,
id = null, price = null, title = null, description = null, image = null,
custom = null, buyButtonText = null, inventory = null, paymentMethods = [],
hidden = false;
unavailable = false;
for (var kp in product) {
var productProperty = product[kp].trim();
@ -217,8 +217,8 @@ document.addEventListener("DOMContentLoaded", function () {
if (productProperty.indexOf('payment_methods:') !== -1) {
goingThroughMethods = true;
}
if (productProperty.indexOf('hidden:') !== -1) {
hidden = productProperty.replace('hidden:', '').trim() === "true";
if (productProperty.indexOf('unavailable:') !== -1) {
unavailable = productProperty.replace('unavailable:', '').trim() === "true";
}
}
@ -234,7 +234,7 @@ document.addEventListener("DOMContentLoaded", function () {
buyButtonText: buyButtonText,
inventory: isNaN(inventory)? null: inventory,
paymentMethods: paymentMethods,
hidden: hidden
unavailable: unavailable
});
}
}
@ -254,7 +254,7 @@ document.addEventListener("DOMContentLoaded", function () {
buyButtonText = product.buyButtonText,
inventory = product.inventory,
paymentMethods = product.paymentMethods,
hidden = product.hidden;
unavailable = product.unavailable;
template += id + ':\n' +
' price: ' + parseFloat(price).noExponents() + '\n' +
@ -275,8 +275,8 @@ document.addEventListener("DOMContentLoaded", function () {
if (buyButtonText != null && buyButtonText.length > 0) {
template += ' buyButtonText: ' + buyButtonText + '\n';
}
if (hidden != null) {
template += ' hidden: ' + hidden.toString() + '\n';
if (unavailable != null) {
template += ' unavailable: ' + unavailable.toString() + '\n';
}
if(paymentMethods != null && paymentMethods.length > 0){
template+= ' payment_methods:\n';
@ -291,7 +291,7 @@ document.addEventListener("DOMContentLoaded", function () {
editItem: function(index){
this.errors = [];
if(index < 0){
this.editingItem = {index:-1, id:"", title: "", price: 0, image: "", description: "", custom: false, inventory: null, paymentMethods: [], hidden: false};
this.editingItem = {index:-1, id:"", title: "", price: 0, image: "", description: "", custom: false, inventory: null, paymentMethods: [], unavailable: false};
}else{
this.editingItem = {...this.items[index], index};
}
@ -382,7 +382,7 @@ document.addEventListener("DOMContentLoaded", function () {
},
unEscape: function(item){
for(var k in item){
if(k !== "paymentMethods" && k!=="id" && k !== "hidden"){
if(k !== "paymentMethods" && k!=="id" && k !== "unavailable"){
item[k] = this.unEscapeKey(item[k]);
}
}

View File

@ -300,8 +300,8 @@
<input type="number" step="1" class="js-product-inventory form-control mb-2" value="{inventory}" />
</div>
<div class="form-group d-flex align-items-center">
<input type="checkbox" class="btcpay-toggle me-2" value="{hidden}" />
<label class="form-label mb-0">Hidden</label>
<input type="checkbox" class="btcpay-toggle me-2" value="{unavailable}" />
<label class="form-label mb-0">Unavailable</label>
</div>
</div>
</script>

View File

@ -216,7 +216,7 @@
var image = item.Image;
var description = item.Description;
@if (item.Hidden) {
@if (item.Unavailable) {
continue;
}

View File

@ -26,7 +26,7 @@
: item.BuyButtonText)
.Replace("{0}",item.Price.Formatted)
.Replace("{Price}",item.Price.Formatted);
@if (item.Hidden) {
@if (item.Unavailable) {
continue;
}