From 893410911cc018c85fdbd4fd288124a164e8a888 Mon Sep 17 00:00:00 2001 From: rockstardev Date: Tue, 14 Aug 2018 18:59:59 +0200 Subject: [PATCH] Button width influenced by generator --- BTCPayServer/Views/Apps/PayButton.cshtml | 52 +++++++++++++++++++----- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/BTCPayServer/Views/Apps/PayButton.cshtml b/BTCPayServer/Views/Apps/PayButton.cshtml index 5162b04c4..00d9e9429 100644 --- a/BTCPayServer/Views/Apps/PayButton.cshtml +++ b/BTCPayServer/Views/Apps/PayButton.cshtml @@ -39,9 +39,18 @@
- - - + + +
@@ -93,7 +102,7 @@ Copy Code
- +

@@ -115,14 +124,37 @@ srvModel: srvModel }, methods: { - inputChanges: function () { - var html = '<form method="POST" action="' + srvModel.urlRoot + '/apps/3jVExUHqRkGi4eaJEFCTxw5zjk14VAFzoVZXZJ3fbwED/pos">'; - html += '\n\t<input type="hidden" name="amount" value="' + srvModel.price + '" />'; - if (srvModel.currency) { - html += '\n\t<input type="hidden" name="currency" value="' + srvModel.currency + '" />'; + inputChanges: function (event, buttonSize) { + if (buttonSize != null) { + srvModel.buttonSize = buttonSize; + alert(buttonSize); } - html += '\n\t<input type="image" src="' + srvModel.urlRoot + '/img/paywithbtcpay.png" name="submit" style="width:210px;" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor">'; + var html = '<form method="POST" action="' + srvModel.urlRoot + '/apps/3jVExUHqRkGi4eaJEFCTxw5zjk14VAFzoVZXZJ3fbwED/pos">'; + html += '\n <input type="hidden" name="amount" value="' + srvModel.price + '" />'; + if (srvModel.currency) { + html += '\n <input type="hidden" name="currency" value="' + srvModel.currency + '" />'; + } + if (srvModel.checkoutDesc) { + html += '\n <input type="hidden" name="checkoutDesc" value="' + srvModel.checkoutDesc + '" />'; + } + if (srvModel.orderId) { + html += '\n <input type="hidden" name="orderId" value="' + srvModel.orderId + '" />'; + } + + var width = "209px"; + if (srvModel.buttonSize == 0) { + width = "146px"; + } else if (srvModel.buttonSize == 1) { + width = "168px"; + } else if (srvModel.buttonSize == 2) { + width = "209px"; + } + $("#previewButton").css("width", width); + + html += '\n <input type="image" src="' + srvModel.urlRoot + '/img/paywithbtcpay.png" name="submit" style="width:' + width + + '" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor">'; + html += '\n</form>'; $("#mainCode").html(html);