diff --git a/app/views/admin/products_v3/_table.html.haml b/app/views/admin/products_v3/_table.html.haml index 28d2a3ded35..89c464ed9bf 100644 --- a/app/views/admin/products_v3/_table.html.haml +++ b/app/views/admin/products_v3/_table.html.haml @@ -1,4 +1,4 @@ -= form_with url: bulk_update_admin_products_v3_index_path, method: :patch, id: "products-form", += form_with url: bulk_update_admin_products_path, method: :patch, id: "products-form", html: {'data-reflex-serialize-form': true, 'data-reflex': 'submit->products#bulk_update', 'data-controller': "bulk-form", 'data-bulk-form-disable-selector-value': "#sort,#filters"} do |form| %fieldset.form-actions.hidden{ 'data-bulk-form-target': "actions" } diff --git a/app/views/spree/admin/shared/_product_sub_menu.html.haml b/app/views/spree/admin/shared/_product_sub_menu.html.haml index 771366f57ac..b89b16c7644 100644 --- a/app/views/spree/admin/shared/_product_sub_menu.html.haml +++ b/app/views/spree/admin/shared/_product_sub_menu.html.haml @@ -1,9 +1,6 @@ - content_for :sub_menu do %ul#sub_nav.inline-menu - - if feature?(:admin_style_v3, spree_current_user) - = tab :products_v3, url: main_app.admin_products_v3_index_path - - else - = tab :products + = tab :products = tab :properties = tab :variant_overrides, url: main_app.admin_inventory_path, match_path: '/inventory' = tab :import, url: main_app.admin_product_import_path, match_path: '/product_import' diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 3d22d652019..b8fef0838c9 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -68,7 +68,7 @@ post '/product_import/reset_absent', to: 'product_import#reset_absent_products', as: 'product_import_reset_async' constraints FeatureToggleConstraint.new(:admin_style_v3) do - resources :products_v3, as: :products_v3, only: :index do + resources :products, to: 'products_v3#index', only: :index do patch :bulk_update, on: :collection end end diff --git a/config/routes/spree.rb b/config/routes/spree.rb index cdc8d7660ed..2568731c9a4 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -50,9 +50,15 @@ resources :users - resources :products do - post :bulk_update, :on => :collection, :as => :bulk_update + constraints FeatureToggleConstraint.new(:admin_style_v3, negate: true) do + # Show old bulk products screen + resources :products, :index do + post :bulk_update, :on => :collection, :as => :bulk_update + end + end + + resources :products, except: :index do member do get :clone get :group_buy_options @@ -78,6 +84,9 @@ end end + # duplicate old path for reference when admin_style_v3 enabled + resources :products_old, to: 'products#index', only: :index + get '/variants/search', :to => "variants#search", :as => :search_variants resources :properties diff --git a/spec/reflexes/products_reflex_spec.rb b/spec/reflexes/products_reflex_spec.rb index ead1c577395..ae95f16b8c6 100644 --- a/spec/reflexes/products_reflex_spec.rb +++ b/spec/reflexes/products_reflex_spec.rb @@ -5,7 +5,7 @@ describe ProductsReflex, type: :reflex do let(:current_user) { create(:admin_user) } # todo: set up an enterprise user to test permissions let(:context) { - { url: admin_products_v3_index_url, connection: { current_user: } } + { url: admin_products_url, connection: { current_user: } } } before do diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index a706beeb414..c6ddc8e7f38 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -19,7 +19,7 @@ end it "can see the new product page" do - visit admin_products_v3_index_url + visit admin_products_url expect(page).to have_content "Bulk Edit Products" end @@ -28,7 +28,7 @@ let!(:product_a) { create(:simple_product, name: "Apples") } before do - visit admin_products_v3_index_url + visit admin_products_url end it "Should sort products alphabetically by default" do @@ -44,7 +44,7 @@ describe "pagination" do before do - visit admin_products_v3_index_url + visit admin_products_url end it "has a pagination, has 15 products per page by default and can change the page" do @@ -76,7 +76,7 @@ let!(:product_by_name) { create(:simple_product, name: "searchable product") } before do - visit admin_products_v3_index_url + visit admin_products_url end it "can search for a product" do @@ -128,7 +128,7 @@ let!(:product_by_supplier) { create(:simple_product, supplier: producer) } it "can search for a product" do - visit admin_products_v3_index_url + visit admin_products_url search_by_producer "Producer 1" @@ -145,7 +145,7 @@ } it "can search for a product" do - visit admin_products_v3_index_url + visit admin_products_url search_by_category "Category 1" @@ -168,7 +168,7 @@ let!(:product_a) { create(:simple_product, name: "Apples", sku: "APL-00") } before do - visit admin_products_v3_index_url + visit admin_products_url end it "shows an actions memu with an edit link when clicking on icon for product" do @@ -198,7 +198,7 @@ let!(:product_a) { create(:simple_product, name: "Apples", sku: "APL-00") } before do - visit admin_products_v3_index_url + visit admin_products_url end it "updates product and variant fields" do