From bc97c076707e5982fe8dc7ec1f37c5d4d29d1bb0 Mon Sep 17 00:00:00 2001 From: Ludovic Date: Thu, 4 Apr 2019 21:32:16 +0200 Subject: [PATCH] Add currency select in Pay Button --- BTCPayServer/Controllers/StoresController.cs | 2 +- BTCPayServer/Views/Stores/PayButton.cshtml | 2 +- BTCPayServer/wwwroot/paybutton/paybutton.js | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index a42c51102..831045d58 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -892,7 +892,7 @@ namespace BTCPayServer.Controllers UrlRoot = appUrl, PayButtonImageUrl = appUrl + "img/paybutton/pay.png", StoreId = store.Id, - ButtonType = 2, + ButtonType = 0, Min = 1, Max = 20, Step = 1 diff --git a/BTCPayServer/Views/Stores/PayButton.cshtml b/BTCPayServer/Views/Stores/PayButton.cshtml index 992df92d4..946fb016c 100644 --- a/BTCPayServer/Views/Stores/PayButton.cshtml +++ b/BTCPayServer/Views/Stores/PayButton.cshtml @@ -18,7 +18,7 @@
-
diff --git a/BTCPayServer/wwwroot/paybutton/paybutton.js b/BTCPayServer/wwwroot/paybutton/paybutton.js index 91e39d3af..047aaae90 100644 --- a/BTCPayServer/wwwroot/paybutton/paybutton.js +++ b/BTCPayServer/wwwroot/paybutton/paybutton.js @@ -62,17 +62,20 @@ function inputChanges(event, buttonSize) { } else if (srvModel.buttonType == 1) { html += '\n
'; + html += '
'; html += addPlusMinusButton("-"); html += addInputPrice(srvModel.price, widthInput, ""); html += addPlusMinusButton("+"); html += '
'; + html += addSelectCurrency(); + html += '
'; } else if (srvModel.buttonType == 2) { html += '\n
'; // Input price html += addInputPrice(srvModel.price, width, 'onchange="document.querySelector(\'#btcpay-input-range\').value = document.querySelector(\'#btcpay-input-price\').value"'); - + html += addSelectCurrency(); // Slider html += ''; @@ -134,10 +137,19 @@ function addPlusMinusButton(type) { function addInputPrice(price, widthInput, customFn) { var input = ''; if (customFn) { return input.replace("CUSTOM", customFn); } return input.replace("CUSTOM", ""); } + +function addSelectCurrency() { + return ''; +}