diff --git a/app/controllers/admin/dfc_product_imports_controller.rb b/app/controllers/admin/dfc_product_imports_controller.rb index 5823978624..8e43a65281 100644 --- a/app/controllers/admin/dfc_product_imports_controller.rb +++ b/app/controllers/admin/dfc_product_imports_controller.rb @@ -10,7 +10,7 @@ module Admin self.class end - def index + def import # The plan: # # * Fetch DFC catalog as JSON from URL. diff --git a/app/views/admin/dfc_product_imports/import.html.haml b/app/views/admin/dfc_product_imports/import.html.haml new file mode 100644 index 0000000000..60a3f7a05a --- /dev/null +++ b/app/views/admin/dfc_product_imports/import.html.haml @@ -0,0 +1,7 @@ +- content_for :page_title do + #{t(".title")} + += render partial: 'spree/admin/shared/product_sub_menu' + +%p= t(".imported_products") += @count diff --git a/app/views/admin/dfc_product_imports/index.html.haml b/app/views/admin/dfc_product_imports/index.html.haml index 60a3f7a05a..4b832fd79d 100644 --- a/app/views/admin/dfc_product_imports/index.html.haml +++ b/app/views/admin/dfc_product_imports/index.html.haml @@ -3,5 +3,4 @@ = render partial: 'spree/admin/shared/product_sub_menu' -%p= t(".imported_products") -= @count +watch this space diff --git a/config/locales/en.yml b/config/locales/en.yml index 07a974d49a..5ee7ba0659 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -846,7 +846,7 @@ en: map: Map dfc_product_imports: - index: + import: title: "Importing a DFC product catalog" imported_products: "Imported products:" enterprise_fees: diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 8036788d46..9c3eb66324 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -69,7 +69,9 @@ Openfoodnetwork::Application.routes.draw do post '/product_import/save_data', to: 'product_import#save_data', as: 'product_import_save_async' post '/product_import/reset_absent', to: 'product_import#reset_absent_products', as: 'product_import_reset_async' - resources :dfc_product_imports, only: [:index] + resources :dfc_product_imports, only: [:index] do + post :import, on: :collection + end constraints FeatureToggleConstraint.new(:admin_style_v3) do # This might be easier to arrange once we rename the controller to plain old "products"