diff --git a/BTCPayServer/Controllers/AppsController.PointOfSale.cs b/BTCPayServer/Controllers/AppsController.PointOfSale.cs index c65f50329..5678fb28f 100644 --- a/BTCPayServer/Controllers/AppsController.PointOfSale.cs +++ b/BTCPayServer/Controllers/AppsController.PointOfSale.cs @@ -20,7 +20,9 @@ namespace BTCPayServer.Controllers Template = "tea:\n" + " price: 0.02\n" + - " title: Green Tea # title is optional, defaults to the keys\n\n" + + " title: Green Tea # title is optional, defaults to the keys\n" + + " description: Lovely, fresh and tender, Meng Ding Gan Lu is grown in the lush Meng Ding Mountains of the southwestern province of Sichuan # description is optional, defalts to none\n" + + " image: https://cdn.pixabay.com/photo/2015/03/26/11/03/green-tea-692339__480.jpg # image is optional, defaults to none\n\n" + "coffee:\n" + " price: 1\n\n" + "bamba:\n" + diff --git a/BTCPayServer/Controllers/AppsPublicController.cs b/BTCPayServer/Controllers/AppsPublicController.cs index 3639b18e1..1b4ae15ef 100644 --- a/BTCPayServer/Controllers/AppsPublicController.cs +++ b/BTCPayServer/Controllers/AppsPublicController.cs @@ -152,7 +152,17 @@ namespace BTCPayServer.Controllers .Where(kv => kv.Value != null) .Select(c => new ViewPointOfSaleViewModel.Item() { + Description = c.Value.Children + .Select(kv => new { Key = (kv.Key as YamlScalarNode)?.Value, Value = kv.Value as YamlScalarNode }) + .Where(kv => kv.Value != null) + .Where(cc => cc.Key == "description") + .FirstOrDefault()?.Value?.Value, Id = c.Key, + Image = c.Value.Children + .Select(kv => new { Key = (kv.Key as YamlScalarNode)?.Value, Value = kv.Value as YamlScalarNode }) + .Where(kv => kv.Value != null) + .Where(cc => cc.Key == "image") + .FirstOrDefault()?.Value?.Value, Title = c.Value.Children .Select(kv => new { Key = (kv.Key as YamlScalarNode)?.Value, Value = kv.Value as YamlScalarNode }) .Where(kv => kv.Value != null) diff --git a/BTCPayServer/Models/AppViewModels/ViewPointOfSaleViewModel.cs b/BTCPayServer/Models/AppViewModels/ViewPointOfSaleViewModel.cs index a723108f3..bd9e72f48 100644 --- a/BTCPayServer/Models/AppViewModels/ViewPointOfSaleViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/ViewPointOfSaleViewModel.cs @@ -14,7 +14,9 @@ namespace BTCPayServer.Models.AppViewModels public string Formatted { get; set; } public decimal Value { get; set; } } + public string Description { get; set; } public string Id { get; set; } + public string Image { get; set; } public ItemPrice Price { get; set; } public string Title { get; set; } } diff --git a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml index 9a5a9cc47..a6ceef075 100644 --- a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml +++ b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml @@ -18,16 +18,30 @@
-

@Model.Title

+

@Model.Title

@for (int i = 0; i < Model.Items.Length; i++) { - var className = (Model.Items.Length - i) > (Model.Items.Length % 3) ? "col-sm-4 mb-3" : "col align-self-center"; + var className = (Model.Items.Length - i) > (Model.Items.Length % 4) ? "col-sm-6 col-lg-3" : "col align-self-center"; var item = Model.Items[i]; -
-

@item.Title

- + var image = item.Image; + var description = item.Description; +
+
+ @if (image != null && image != String.Empty) + { + Card image cap + } +
+
@item.Title
+ @if (description != null && description != String.Empty) + { +

@description

+ } + +
+
}
@@ -38,7 +52,7 @@
 
-
+