From b14cd08990ea026bf42f3969397c732dc12faca1 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Tue, 13 Aug 2024 14:23:39 +0500 Subject: [PATCH] 12698 - keep old UI URL as it is --- app/helpers/admin/products_helper.rb | 8 ++++++-- app/views/spree/admin/products/edit.html.haml | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/helpers/admin/products_helper.rb b/app/helpers/admin/products_helper.rb index 334743a62b..990a47b95a 100644 --- a/app/helpers/admin/products_helper.rb +++ b/app/helpers/admin/products_helper.rb @@ -28,8 +28,12 @@ module Admin [precised_unit_value, variant.unit_description].compact_blank.join(" ") end - def products_return_to_url - session[:products_return_to_url] || admin_products_url + def products_return_to_url(url_filters) + if feature?(:admin_style_v3, spree_current_user) + return session[:products_return_to_url] || admin_products_url + end + + "#{admin_products_path}#{url_filters.empty? ? '' : "#?#{url_filters.to_query}"}" end end end diff --git a/app/views/spree/admin/products/edit.html.haml b/app/views/spree/admin/products/edit.html.haml index f30115860c..8591ffe211 100644 --- a/app/views/spree/admin/products/edit.html.haml +++ b/app/views/spree/admin/products/edit.html.haml @@ -1,7 +1,7 @@ = admin_inject_available_units - content_for :page_actions do - %li= button_link_to t('admin.products.back_to_products_list'), products_return_to_url, :icon => 'icon-arrow-left' + %li= button_link_to t('admin.products.back_to_products_list'), products_return_to_url(@url_filters), :icon => 'icon-arrow-left' %li#new_product_link = button_link_to t(:new_product), new_object_url, { :icon => 'icon-plus', :id => 'admin_new_product' } @@ -16,4 +16,4 @@ .form-buttons.filter-actions.actions = button t(:update), 'icon-refresh' - = button_link_to t(:cancel), products_return_to_url, icon: 'icon-remove' + = button_link_to t(:cancel), products_return_to_url(@url_filters), icon: 'icon-remove'