diff --git a/assets/views/shop/_product_grid.html b/assets/views/shop/_product_grid.html index 48da173..390b7a3 100644 --- a/assets/views/shop/_product_grid.html +++ b/assets/views/shop/_product_grid.html @@ -1,39 +1,9 @@ -{# Product collection with a grid / list view toggle. - The chosen view is held in Alpine and persisted to localStorage so it - survives navigation; `_card.html` reads the same `view` state to switch - its own layout between a vertical card and a horizontal row. #} -
- -
-
- - -
-
- - -
- {% for product in products %} - {% include "shop/_card.html" %} - {% endfor %} -
+{# Product collection. The grid / list `view` state is provided by the Alpine + wrapper in _search.html (it persists across htmx swaps and is shared with the + sort + view-toggle row); `_card.html` reads the same `view` to switch its own + layout between a vertical card and a horizontal row. #} +
+ {% for product in products %} + {% include "shop/_card.html" %} + {% endfor %}
diff --git a/assets/views/shop/_results.html b/assets/views/shop/_results.html index a34f914..178dbb7 100644 --- a/assets/views/shop/_results.html +++ b/assets/views/shop/_results.html @@ -3,9 +3,17 @@ pagination. #} {% set L = lang | default(value='sk') %}
-

- {{ t(key="results-count", lang=L, count=total) }}{% if query and query != "" %} · “{{ query }}”{% endif %} -

+
+

+ {{ t(key="results-count", lang=L, count=total) }}{% if query and query != "" %} · “{{ query }}”{% endif %} +

+ {% if query_base and query_base != "" %} + + {{ t(key="filter-clear", lang=L) }} + + {% endif %} +
{% if products | length > 0 %} {% include "shop/_product_grid.html" %} diff --git a/assets/views/shop/_search.html b/assets/views/shop/_search.html index a05aa20..6aa38e8 100644 --- a/assets/views/shop/_search.html +++ b/assets/views/shop/_search.html @@ -1,20 +1,28 @@ -{# Shared storefront search + filter toolbar and results region, used by the shop - index and every category page. One form drives the whole listing: htmx re-runs - /search and swaps only #shop-results; the toolbar keeps its own DOM state. - Triggers: live (debounced) typing in the search box, immediate on any - select/checkbox change, and submit (Enter / Apply) for the price band. Degrades - to a plain GET form without JS. - Expects: query, category_groups, selected_category, selected_category_id, - uncategorized_count, sort, min_price, max_price, price_floor, price_ceil, - in_stock, plus the result vars consumed by _results.html. #} +{# Shared storefront search box + results region, used by the shop index and + every category page. One form drives the listing: htmx re-runs /search and + swaps only #shop-results; the toolbar keeps its own DOM state. Triggers: live + (debounced) typing in the search box, immediate on a sort change, and submit + (Enter). Degrades to a plain GET form without JS. + Category is chosen from the sidebar (carried here as a hidden field so it + survives a search / re-sort). The grid/list view toggle lives next to sort; + its `view` state is held in Alpine on this wrapper so both the toggle and the + swapped-in product grid (and `_card.html`) share it. + Expects: query, selected_category, sort, plus the result vars consumed by + _results.html. #} {% set L = lang | default(value='sk') %} -
+