From d49bbc95afff9f7e8392e7667aa97c18c8ce236a Mon Sep 17 00:00:00 2001 From: rockstardev Date: Mon, 16 Jul 2018 23:43:52 -0500 Subject: [PATCH] Tweaking display with display name and crypto code --- .../Controllers/InvoiceController.UI.cs | 19 ++++++++++++++----- .../Models/InvoicingModels/PaymentModel.cs | 1 + .../Views/Invoice/Checkout-Body.cshtml | 1 + .../wwwroot/checkout/css/vex-extrastyles.css | 17 +++++++++++------ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index c9a93e7b7..2d462bba2 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -248,8 +248,8 @@ namespace BTCPayServer.Controllers { CryptoCode = network.CryptoCode, PaymentMethodId = paymentMethodId.ToString(), - PaymentMethodName = network.DisplayName, - CryptoImage = "/" + GetImage(paymentMethodId, network), + PaymentMethodName = GetDisplayName(paymentMethodId, network), + CryptoImage = GetImage(paymentMethodId, network), IsLightning = paymentMethodId.PaymentType == PaymentTypes.LightningLike, ServerUrl = HttpContext.Request.GetAbsoluteRoot(), OrderId = invoice.OrderId, @@ -289,9 +289,10 @@ namespace BTCPayServer.Controllers .Select(kv => new PaymentModel.AvailableCrypto() { PaymentMethodId = kv.GetId().ToString(), - PaymentMethodName = kv.Network.DisplayName, + CryptoCode = kv.GetId().CryptoCode, + PaymentMethodName = GetDisplayName(kv.GetId(), kv.Network), LightningLike = kv.GetId().PaymentType == PaymentTypes.LightningLike, - CryptoImage = "/" + GetImage(kv.GetId(), kv.Network), + CryptoImage = GetImage(kv.GetId(), kv.Network), Link = Url.Action(nameof(Checkout), new { invoiceId = invoiceId, paymentMethodId = kv.GetId().ToString() }) }).Where(c => c.CryptoImage != "/") .OrderBy(a => a.PaymentMethodName).ThenBy(a => a.LightningLike ? 1 : 0) @@ -303,9 +304,17 @@ namespace BTCPayServer.Controllers return model; } + private string GetDisplayName(PaymentMethodId paymentMethodId, BTCPayNetwork network) + { + return paymentMethodId.PaymentType == PaymentTypes.BTCLike ? + network.DisplayName : network.DisplayName + " - Lightning Network"; + } + private string GetImage(PaymentMethodId paymentMethodId, BTCPayNetwork network) { - return (paymentMethodId.PaymentType == PaymentTypes.BTCLike ? Url.Content(network.CryptoImagePath) : Url.Content(network.LightningImagePath)); + var res = paymentMethodId.PaymentType == PaymentTypes.BTCLike ? + Url.Content(network.CryptoImagePath) : Url.Content(network.LightningImagePath); + return "/" + res; } private string OrderAmountFromInvoice(string cryptoCode, ProductInformation productInformation) diff --git a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs index 23215f7b4..efa825352 100644 --- a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs +++ b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs @@ -14,6 +14,7 @@ namespace BTCPayServer.Models.InvoicingModels public string Link { get; set; } public string PaymentMethodName { get; set; } public bool LightningLike { get; set; } + public string CryptoCode { get; set; } } public string HtmlTitle { get; set; } public string CustomCSSLink { get; set; } diff --git a/BTCPayServer/Views/Invoice/Checkout-Body.cshtml b/BTCPayServer/Views/Invoice/Checkout-Body.cshtml index e24cb4675..e6356bfea 100644 --- a/BTCPayServer/Views/Invoice/Checkout-Body.cshtml +++ b/BTCPayServer/Views/Invoice/Checkout-Body.cshtml @@ -54,6 +54,7 @@ @crypto.PaymentMethodId @crypto.PaymentMethodName + @crypto.CryptoCode } diff --git a/BTCPayServer/wwwroot/checkout/css/vex-extrastyles.css b/BTCPayServer/wwwroot/checkout/css/vex-extrastyles.css index a2a7bd9d2..d7cc5dd80 100644 --- a/BTCPayServer/wwwroot/checkout/css/vex-extrastyles.css +++ b/BTCPayServer/wwwroot/checkout/css/vex-extrastyles.css @@ -19,13 +19,18 @@ display: block; } - .vexmenuitem:hover { - background-color: #eee; - } + .vexmenuitem a span { + float: right; + color: gray; + } - .vexmenuitem:last-child { - border-bottom: none; - } +.vexmenuitem:hover { + background-color: #eee; +} + +.vexmenuitem:last-child { + border-bottom: none; +} #vexPopupDialog { display: none;