From 7601fc704dd79e4c8014b395738365928f88c8de Mon Sep 17 00:00:00 2001 From: Priec Date: Wed, 17 Jun 2026 19:00:17 +0200 Subject: [PATCH] dialog to ask if remove item compltely --- assets/i18n/en/main.ftl | 1 + assets/i18n/sk/main.ftl | 1 + assets/views/shop/_cart_body.html | 13 +++++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/assets/i18n/en/main.ftl b/assets/i18n/en/main.ftl index bb8c7cd..ab2a243 100644 --- a/assets/i18n/en/main.ftl +++ b/assets/i18n/en/main.ftl @@ -215,6 +215,7 @@ cart-empty = Your cart is empty. cart-total = Total cart-checkout = Proceed to checkout cart-remove = Remove +cart-remove-confirm = Remove this item from the cart? cart-update = Update cart-continue = Continue shopping checkout-title = Checkout diff --git a/assets/i18n/sk/main.ftl b/assets/i18n/sk/main.ftl index 0f6d666..57a8f2e 100644 --- a/assets/i18n/sk/main.ftl +++ b/assets/i18n/sk/main.ftl @@ -215,6 +215,7 @@ cart-empty = Váš košík je prázdny. cart-total = Spolu cart-checkout = Pokračovať k pokladni cart-remove = Odstrániť +cart-remove-confirm = Odstrániť túto položku z košíka? cart-update = Aktualizovať cart-continue = Pokračovať v nákupe checkout-title = Pokladňa diff --git a/assets/views/shop/_cart_body.html b/assets/views/shop/_cart_body.html index 7580389..dbbfd86 100644 --- a/assets/views/shop/_cart_body.html +++ b/assets/views/shop/_cart_body.html @@ -21,11 +21,20 @@ {{ item.price }} {{ item.currency }} - {# Changing the quantity posts via htmx and swaps only #cart-body. #} + {# Changing the quantity posts via htmx (custom `cartchange` event) and + swaps only #cart-body. Dropping to 0 asks for confirmation first, + reverting to the previous quantity if the customer cancels. #}
+ hx-post="/cart/update" hx-trigger="cartchange" hx-target="#cart-body" hx-swap="innerHTML">