From 1850f298a6a61ede24c653ea1009a28cd69ceed6 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Wed, 17 Jul 2024 10:16:52 +0500 Subject: [PATCH 1/3] 11640 - use turbo navigation --- app/views/admin/products_v3/_filters.html.haml | 2 +- app/views/admin/products_v3/_sort.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/products_v3/_filters.html.haml b/app/views/admin/products_v3/_filters.html.haml index 4b90628c7c..a75d27240f 100644 --- a/app/views/admin/products_v3/_filters.html.haml +++ b/app/views/admin/products_v3/_filters.html.haml @@ -1,4 +1,4 @@ -= 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 '[q][s]', params.dig(:q, :s) || 'name asc', class: 'sort', 'data-default': 'name asc' diff --git a/app/views/admin/products_v3/_sort.html.haml b/app/views/admin/products_v3/_sort.html.haml index 6749b3b07a..4cb5f29ee9 100644 --- a/app/views/admin/products_v3/_sort.html.haml +++ b/app/views/admin/products_v3/_sort.html.haml @@ -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 From 1af811cf5114f4f456a71dde3ff505494e8b1938 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Wed, 17 Jul 2024 10:17:06 +0500 Subject: [PATCH 2/3] 11640 - fix per_page issue when the page is changed - Fix the scenario when per_page is selected as 100 and next page is clicked, then per_page is empty in the request. - Expected behavior should be that it retains the per_page selected previously --- app/views/admin/products_v3/_filters.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/products_v3/_filters.html.haml b/app/views/admin/products_v3/_filters.html.haml index a75d27240f..d5d2053ee7 100644 --- a/app/views/admin/products_v3/_filters.html.haml +++ b/app/views/admin/products_v3/_filters.html.haml @@ -1,6 +1,6 @@ = 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 From a6efad73a8802634ce3610deee5c57e6fb4279cc Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Mon, 22 Jul 2024 13:45:01 +0500 Subject: [PATCH 3/3] 12551 - add no-cache policy for Turbo cache control --- app/views/spree/admin/shared/_head.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/spree/admin/shared/_head.html.haml b/app/views/spree/admin/shared/_head.html.haml index cd1fa4cda3..e4f9febe72 100644 --- a/app/views/spree/admin/shared/_head.html.haml +++ b/app/views/spree/admin/shared/_head.html.haml @@ -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