From a171e002804f1ed5d1a7defd45b2c2b09c228866 Mon Sep 17 00:00:00 2001 From: lepipele Date: Wed, 28 Mar 2018 02:13:00 -0500 Subject: [PATCH] Adding PeerInfo textbox We'll need to heavily refactor this HTML and CSS... way to many styles and complex structure --- .../Controllers/InvoiceController.UI.cs | 3 + .../Models/InvoicingModels/PaymentModel.cs | 1 + .../Views/Invoice/Checkout-Body.cshtml | 104 ++++++++++++------ BTCPayServer/wwwroot/css/normalizer.css | 4 + BTCPayServer/wwwroot/js/checkout/core.js | 15 ++- 5 files changed, 91 insertions(+), 36 deletions(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index 963003055..900fbb1d8 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -229,6 +229,9 @@ namespace BTCPayServer.Controllers InvoiceBitcoinUrl = paymentMethodId.PaymentType == PaymentTypes.BTCLike ? cryptoInfo.PaymentUrls.BIP21 : paymentMethodId.PaymentType == PaymentTypes.LightningLike ? cryptoInfo.PaymentUrls.BOLT11 : throw new NotSupportedException(), + // TEST PLACEHOLDER FOR PEER INFO DATA... REPLACE! + PeerInfo = "039cc950286a8fa99218283d1adc2456e0d5e81be558da77dd6e85ba9a1fff5ad3@34.200.252.146", + // EOF InvoiceBitcoinUrlQR = paymentMethodId.PaymentType == PaymentTypes.BTCLike ? cryptoInfo.PaymentUrls.BIP21 : paymentMethodId.PaymentType == PaymentTypes.LightningLike ? cryptoInfo.PaymentUrls.BOLT11.ToUpperInvariant() : throw new NotSupportedException(), diff --git a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs index f638abab4..92d957be4 100644 --- a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs +++ b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs @@ -49,5 +49,6 @@ namespace BTCPayServer.Models.InvoicingModels public string PaymentMethodId { get; internal set; } public bool AllowCoinConversion { get; set; } + public string PeerInfo { get; set; } } } diff --git a/BTCPayServer/Views/Invoice/Checkout-Body.cshtml b/BTCPayServer/Views/Invoice/Checkout-Body.cshtml index e01e62a56..da67f887d 100644 --- a/BTCPayServer/Views/Invoice/Checkout-Body.cshtml +++ b/BTCPayServer/Views/Invoice/Checkout-Body.cshtml @@ -3,7 +3,7 @@
- @if(Model.CustomLogoLink != null) + @if (Model.CustomLogoLink != null) { } @@ -33,7 +33,7 @@
- @if(Model.AvailableCryptos.Count > 1) + @if (Model.AvailableCryptos.Count > 1) {
@@ -43,7 +43,7 @@
- @foreach(var crypto in Model.AvailableCryptos) + @foreach (var crypto in Model.AvailableCryptos) { @crypto.PaymentMethodId @@ -108,7 +108,7 @@
{{$t("Copy")}}
- @if(Model.AllowCoinConversion) + @if (Model.AllowCoinConversion) {
{{$t("Conversion")}} @@ -164,53 +164,91 @@
{{$t("CompletePay_Body", srvModel)}}
-
-
-
{{$t("Amount")}}
- -
- {{srvModel.btcDue}} {{ srvModel.cryptoCode }} -
- {{$t("Copied")}} -
-
- -
-
-
-
-
-
-
{{$t("Address")}}
- -
+
+ +
- @if(Model.AllowCoinConversion) + @if (Model.AllowCoinConversion) {
-
+
-
} diff --git a/BTCPayServer/wwwroot/css/normalizer.css b/BTCPayServer/wwwroot/css/normalizer.css index 61c60a479..d2ca885ae 100644 --- a/BTCPayServer/wwwroot/css/normalizer.css +++ b/BTCPayServer/wwwroot/css/normalizer.css @@ -8882,6 +8882,10 @@ strong { opacity: 1; } + .manual-box__address__value .copied-label { + margin-top: 5px; + } + .manual-box__address__wrapper { background: rgba(182, 182, 182, 0.13); border: 1px solid rgba(77, 77, 77, 0.07); diff --git a/BTCPayServer/wwwroot/js/checkout/core.js b/BTCPayServer/wwwroot/js/checkout/core.js index 44e8a64b8..3ea17cb7c 100644 --- a/BTCPayServer/wwwroot/js/checkout/core.js +++ b/BTCPayServer/wwwroot/js/checkout/core.js @@ -317,12 +317,21 @@ $(document).ready(function () { } }); // Address - var copyAddress = new Clipboard('.manual-box__address__value', { + var copyAddress = new Clipboard('#btcAddress', { target: function () { - var $elm = $(".manual-box__address__value"); + var $elm = $("#btcAddress"); $elm.removeClass("copy-cursor").addClass("copied"); setTimeout(function () { $elm.removeClass("copied").addClass("copy-cursor"); }, 500); - return document.querySelector('.manual-box__address__value .manual-box__address__wrapper .manual-box__address__wrapper__value'); + return document.querySelector('#btcAddressValue'); + } + }); + // PeerInfo + var copyAddress = new Clipboard('#peerInfo', { + target: function () { + var $elm = $("#peerInfo"); + $elm.removeClass("copy-cursor").addClass("copied"); + setTimeout(function () { $elm.removeClass("copied").addClass("copy-cursor"); }, 500); + return document.querySelector('#peerInfoValue'); } });