mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-12 10:30:47 +01:00
Tweaking display with display name and crypto code
This commit is contained in:
parent
c44132fd35
commit
d49bbc95af
4 changed files with 27 additions and 11 deletions
|
@ -248,8 +248,8 @@ namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
CryptoCode = network.CryptoCode,
|
CryptoCode = network.CryptoCode,
|
||||||
PaymentMethodId = paymentMethodId.ToString(),
|
PaymentMethodId = paymentMethodId.ToString(),
|
||||||
PaymentMethodName = network.DisplayName,
|
PaymentMethodName = GetDisplayName(paymentMethodId, network),
|
||||||
CryptoImage = "/" + GetImage(paymentMethodId, network),
|
CryptoImage = GetImage(paymentMethodId, network),
|
||||||
IsLightning = paymentMethodId.PaymentType == PaymentTypes.LightningLike,
|
IsLightning = paymentMethodId.PaymentType == PaymentTypes.LightningLike,
|
||||||
ServerUrl = HttpContext.Request.GetAbsoluteRoot(),
|
ServerUrl = HttpContext.Request.GetAbsoluteRoot(),
|
||||||
OrderId = invoice.OrderId,
|
OrderId = invoice.OrderId,
|
||||||
|
@ -289,9 +289,10 @@ namespace BTCPayServer.Controllers
|
||||||
.Select(kv => new PaymentModel.AvailableCrypto()
|
.Select(kv => new PaymentModel.AvailableCrypto()
|
||||||
{
|
{
|
||||||
PaymentMethodId = kv.GetId().ToString(),
|
PaymentMethodId = kv.GetId().ToString(),
|
||||||
PaymentMethodName = kv.Network.DisplayName,
|
CryptoCode = kv.GetId().CryptoCode,
|
||||||
|
PaymentMethodName = GetDisplayName(kv.GetId(), kv.Network),
|
||||||
LightningLike = kv.GetId().PaymentType == PaymentTypes.LightningLike,
|
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() })
|
Link = Url.Action(nameof(Checkout), new { invoiceId = invoiceId, paymentMethodId = kv.GetId().ToString() })
|
||||||
}).Where(c => c.CryptoImage != "/")
|
}).Where(c => c.CryptoImage != "/")
|
||||||
.OrderBy(a => a.PaymentMethodName).ThenBy(a => a.LightningLike ? 1 : 0)
|
.OrderBy(a => a.PaymentMethodName).ThenBy(a => a.LightningLike ? 1 : 0)
|
||||||
|
@ -303,9 +304,17 @@ namespace BTCPayServer.Controllers
|
||||||
return model;
|
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)
|
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)
|
private string OrderAmountFromInvoice(string cryptoCode, ProductInformation productInformation)
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace BTCPayServer.Models.InvoicingModels
|
||||||
public string Link { get; set; }
|
public string Link { get; set; }
|
||||||
public string PaymentMethodName { get; set; }
|
public string PaymentMethodName { get; set; }
|
||||||
public bool LightningLike { get; set; }
|
public bool LightningLike { get; set; }
|
||||||
|
public string CryptoCode { get; set; }
|
||||||
}
|
}
|
||||||
public string HtmlTitle { get; set; }
|
public string HtmlTitle { get; set; }
|
||||||
public string CustomCSSLink { get; set; }
|
public string CustomCSSLink { get; set; }
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
<a href="@crypto.Link" onclick="return closeVexChangeCurrency('@crypto.PaymentMethodId');">
|
<a href="@crypto.Link" onclick="return closeVexChangeCurrency('@crypto.PaymentMethodId');">
|
||||||
<img style="height:24px;" alt="@crypto.PaymentMethodId" src="@crypto.CryptoImage" />
|
<img style="height:24px;" alt="@crypto.PaymentMethodId" src="@crypto.CryptoImage" />
|
||||||
@crypto.PaymentMethodName
|
@crypto.PaymentMethodName
|
||||||
|
<span>@crypto.CryptoCode</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,18 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vexmenuitem:hover {
|
.vexmenuitem a span {
|
||||||
background-color: #eee;
|
float: right;
|
||||||
}
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
.vexmenuitem:last-child {
|
.vexmenuitem:hover {
|
||||||
border-bottom: none;
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vexmenuitem:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
#vexPopupDialog {
|
#vexPopupDialog {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
Loading…
Add table
Reference in a new issue