Merge pull request #12678 from chahmedejaz/bugfix/11640-products-page-broken-URL

Fix URL State management on the Products page
This commit is contained in:
Filipe
2024-07-25 20:00:49 +01:00
committed by GitHub
3 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
= form_with url: admin_products_path, id: "filters", method: :get, data: { "search-target": "form", 'turbo-frame': "_self" } do
= form_with url: admin_products_path, id: "filters", method: :get, data: { "search-target": "form", 'turbo-frame': "_self", 'turbo-action': "advance" } do
= hidden_field_tag :page, nil, class: "page"
= hidden_field_tag :per_page, nil, class: "per-page"
= hidden_field_tag :per_page, params[:per_page], class: "per-page"
= hidden_field_tag '[q][s]', params.dig(:q, :s) || 'name asc', class: 'sort', 'data-default': 'name asc'
.query

View File

@@ -4,7 +4,7 @@
= t(".pagination.total_html", total: pagy.count, from: pagy.from, to: pagy.to)
- if search_term.present? || producer_id.present? || category_id.present?
%a{ href: url_for(page: 1), class: "button disruptive", 'data-turbo-frame': "_self" }
%a{ href: url_for(page: 1), class: "button disruptive", data: { 'turbo-frame': "_self", 'turbo-action': "advance" } }
= t(".pagination.clear_search")
%form.with-dropdown

View File

@@ -1,4 +1,5 @@
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}
%meta{ name: "turbo-cache-control", content: "no-cache" }
= csrf_meta_tags
= action_cable_meta_tag