diff --git a/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs b/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs index ebb0dc362..6c688a26b 100644 --- a/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs @@ -40,5 +40,6 @@ namespace BTCPayServer.Models.StoreViewModels public string UrlRoot { get; set; } public List CurrencyDropdown { get; set; } public string PayButtonImageUrl { get; set; } + public string PayButtonText { get; set; } } } diff --git a/BTCPayServer/Views/Stores/PayButton.cshtml b/BTCPayServer/Views/Stores/PayButton.cshtml index bcd1f633b..787dfac77 100644 --- a/BTCPayServer/Views/Stores/PayButton.cshtml +++ b/BTCPayServer/Views/Stores/PayButton.cshtml @@ -47,15 +47,26 @@
+
+ +
+
+ + +
+ v-validate="{ required: this.imageUrlRequired, url: {require_tld:false} }" + :class="{'is-invalid': errors.has('payButtonImageUrl') }"> {{ errors.first('payButtonImageUrl') }}
- +
- - - {{ errors.first('fitButtonInline') }} + + + {{ errors.first('fitButtonInline') }}
@@ -232,13 +243,33 @@ var payButtonCtrl = new Vue({ el: '#payButtonCtrl', data: { - srvModel: srvModel + srvModel: srvModel, + originalButtonImageUrl: srvModel.payButtonImageUrl, + buttonInlineTextMode: false + }, + computed: { + imageUrlRequired: function(){ + return !this.buttonInlineTextMode; + } }, methods: { inputChanges: function (event, buttonSize) { inputChanges(event, buttonSize); } - } + + }, + watch: { + buttonInlineTextMode: function (checked) { + if(!checked){ + this.srvModel.payButtonText = ""; + this.srvModel.payButtonImageUrl = this.originalButtonImageUrl; + }else { + this.srvModel.payButtonText = "Pay with.."; + this.srvModel.payButtonImageUrl = this.srvModel.urlRoot + "img/logo.svg"; + } + this.inputChanges(); + } + } }); } diff --git a/BTCPayServer/wwwroot/paybutton/paybutton.js b/BTCPayServer/wwwroot/paybutton/paybutton.js index dc445186a..342bbba9e 100644 --- a/BTCPayServer/wwwroot/paybutton/paybutton.js +++ b/BTCPayServer/wwwroot/paybutton/paybutton.js @@ -51,14 +51,18 @@ function inputChanges(event, buttonSize) { var isSlider = srvModel.buttonType == 2 var width = "209px"; + var height = "57px"; var widthInput = "3em"; if (srvModel.buttonSize === 0) { width = "146px"; widthInput = "2em"; + height = "40px"; } else if (srvModel.buttonSize === 1) { width = "168px"; + height = "46px"; } else if (srvModel.buttonSize === 2) { width = "209px"; + height = "57px"; } var html = @@ -103,8 +107,15 @@ function inputChanges(event, buttonSize) { html += addSlider(srvModel.price, srvModel.min, srvModel.max, srvModel.step, width); html += '
\n'; } - - html += ' \n'; + + if(!srvModel.payButtonText){ + html += ' \n'; + }else{ + var numwidth = parseInt(width.replace("px", "")); + html+= '' + } html += ''; $("#mainCode").text(html).html();