From 9e91259b9ef2d1739fe5c700d2428d97783208a9 Mon Sep 17 00:00:00 2001 From: Kukks Date: Mon, 11 Mar 2019 15:01:56 +0100 Subject: [PATCH 1/2] attempt fix pos css grid --- .../Views/AppsPublic/ViewPointOfSale.cshtml | 171 ++++++++---------- 1 file changed, 72 insertions(+), 99 deletions(-) diff --git a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml index 56158427c..956a16167 100644 --- a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml +++ b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml @@ -239,42 +239,29 @@
-
- - - @{ - var rowsJ = Model.Items.Length/4 + (Model.Items.Length % 4 > 0 ? 1 : 0); - } - @for (int x = 0; x < rowsJ; x++) - { - var startingIndex = x == 0 ? 0 : x * 4; - var endLoopIndex = startingIndex + Math.Min(4, Model.Items.Length - startingIndex); - -
- @for (int i = startingIndex; i < endLoopIndex; i++) - { - var item = Model.Items[i]; - var image = item.Image; - var description = item.Description; +
-
- @if (!String.IsNullOrWhiteSpace(image)) - { - Card image cap - } -
-
@item.Title
- @if (!String.IsNullOrWhiteSpace(description)) - { -

@description

- } - @String.Format(Model.ButtonText, @item.Price.Formatted) -
-
- - } -
- } + @for (var index = 0; index < Model.Items.Length; index++) + { + var item = Model.Items[index]; + var image = item.Image; + var description = item.Description; + +
+ @if (!String.IsNullOrWhiteSpace(image)) + { + @:Card image cap + } +
+
@item.Title
+ @if (!String.IsNullOrWhiteSpace(description)) + { +

@description

+ } + @String.Format(Model.ButtonText, @item.Price.Formatted) +
+
+ }
@@ -314,82 +301,68 @@

@Model.Title

- @{ - var rows = Model.Items.Length/4 + (Model.Items.Length % 4 > 0 ? 1 : 0); - } - @for (int x = 0; x < rows; x++) - { - var startingIndex = x == 0 ? 0 : x * 4; - var endLoopIndex = startingIndex + Math.Min(4, Model.Items.Length - startingIndex); - -
- @for (int i = startingIndex; i < endLoopIndex; i++) + +
+ @for (int x = 0; x < Model.Items.Length; x++) { - var item = Model.Items[i]; - var image = item.Image; - var description = item.Description; -
- @if (!String.IsNullOrWhiteSpace(image)) + var item = Model.Items[x]; + +
+ @if (!String.IsNullOrWhiteSpace(item.Image)) + { + Card image cap + } +
+
@item.Title
+ @if (!String.IsNullOrWhiteSpace(item.Description)) { - Card image cap +

@item.Description

} -
-
@item.Title
- @if (!String.IsNullOrWhiteSpace(description)) - { -

@description

- } - @if (item.Custom && !Model.EnableShoppingCart) - { -
- -
-
- @Model.CurrencySymbol -
- -
- -
-
-
- } - else - { -
- -
- } -
-
- } -
- } - - @if (Model.ShowCustomAmount) - { -
-
-
-
-
Custom Amount
-

Create invoice to pay custom amount

+ @if (item.Custom && !Model.EnableShoppingCart) + {
+
@Model.CurrencySymbol
- -
+ +
+ +
-
+ } + else + { +
+ +
+ }
-
- } + } + @if (Model.ShowCustomAmount) + { +
+
+
Custom Amount
+

Create invoice to pay custom amount

+
+
+
+ @Model.CurrencySymbol +
+ +
+
+
+
+
+ } +
} From 5c618233cb653728ad94b96668d52144800ab6bd Mon Sep 17 00:00:00 2001 From: Kukks Date: Mon, 18 Mar 2019 07:39:45 +0100 Subject: [PATCH 2/2] fix singular item in pos stretched width --- BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml index 956a16167..9445f6b5c 100644 --- a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml +++ b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml @@ -1,4 +1,4 @@ -@addTagHelper *, Meziantou.AspNetCore.BundleTagHelpers +@addTagHelper *, Meziantou.AspNetCore.BundleTagHelpers @inject BTCPayServer.HostedServices.CssThemeManager themeManager @model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel @@ -41,6 +41,10 @@ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); grid-gap: .5rem; } + .card-deck .card:only-of-type { + max-width: 320px; + margin: auto; + }