diff --git a/config/routes.rb b/config/routes.rb index 229b26e331..ca05884234 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,10 +58,6 @@ Openfoodnetwork::Application.routes.draw do resources :webhooks, only: [:create] end - namespace :admin do - resources :bulk_line_items - end - get '/checkout', :to => 'checkout#edit' , :as => :checkout put '/checkout', :to => 'checkout#update' , :as => :update_checkout get '/checkout/paypal_payment/:order_id', to: 'checkout#paypal_payment', as: :paypal_payment @@ -84,119 +80,6 @@ Openfoodnetwork::Application.routes.draw do get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop' get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL - namespace :admin do - resources :order_cycles do - post :bulk_update, on: :collection, as: :bulk_update - - member do - get :clone - post :notify_producers - end - end - - resources :enterprises do - collection do - get :for_order_cycle - get :visible - post :bulk_update, as: :bulk_update - end - - member do - get :welcome - put :register - end - - resources :producer_properties do - post :update_positions, on: :collection - end - - resources :tag_rules, only: [:destroy] - end - - resources :manager_invitations, only: [:create] - - resources :enterprise_relationships - resources :enterprise_roles - - resources :enterprise_fees do - collection do - get :for_order_cycle - post :bulk_update, :as => :bulk_update - end - end - - resources :enterprise_groups do - get :move_up - get :move_down - end - - get '/inventory', to: 'variant_overrides#index' - - get '/product_import', to: 'product_import#index' - post '/product_import', to: 'product_import#import' - post '/product_import/validate_data', to: 'product_import#validate_data', as: 'product_import_process_async' - 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 :variant_overrides do - post :bulk_update, on: :collection - post :bulk_reset, on: :collection - end - - resources :inventory_items, only: [:create, :update] - - resources :customers, only: [:index, :create, :update, :destroy, :show] - - resources :tag_rules, only: [], format: :json do - get :map_by_tag, on: :collection - end - - resource :content - - resource :accounts_and_billing_settings, only: [:edit, :update] do - collection do - get :show_methods - get :start_job - end - end - - resource :business_model_configuration, only: [:edit, :update], controller: 'business_model_configuration' - - resource :cache_settings - - resource :account, only: [:show], controller: 'account' - - resources :column_preferences, only: [], format: :json do - put :bulk_update, on: :collection - end - - resource :invoice_settings, only: [:edit, :update] - - resource :stripe_connect_settings, only: [:edit, :update] - - resources :stripe_accounts, only: [:destroy] do - get :connect, on: :collection - get :status, on: :collection - end - - resources :schedules, only: [:index, :create, :update, :destroy], format: :json - - resources :subscriptions, only: [:index, :new, :create, :edit, :update] do - put :cancel, on: :member - put :pause, on: :member - put :unpause, on: :member - end - - resources :subscription_line_items, only: [], format: :json do - post :build, on: :collection - end - - resources :proxy_orders, only: [:edit] do - put :cancel, on: :member, format: :json - put :resume, on: :member, format: :json - end - end - namespace :api do resources :enterprises do post :update_image, on: :member @@ -230,6 +113,7 @@ Openfoodnetwork::Application.routes.draw do end +require Rails.root.join("config/routes/admin.rb") # Overriding Devise routes to use our own controller Spree::Core::Engine.routes.draw do diff --git a/config/routes/admin.rb b/config/routes/admin.rb new file mode 100644 index 0000000000..ce58bc480b --- /dev/null +++ b/config/routes/admin.rb @@ -0,0 +1,116 @@ +Openfoodnetwork::Application.routes.draw do + namespace :admin do + resources :bulk_line_items + + resources :order_cycles do + post :bulk_update, on: :collection, as: :bulk_update + + member do + get :clone + post :notify_producers + end + end + + resources :enterprises do + collection do + get :for_order_cycle + get :visible + post :bulk_update, as: :bulk_update + end + + member do + get :welcome + put :register + end + + resources :producer_properties do + post :update_positions, on: :collection + end + + resources :tag_rules, only: [:destroy] + end + + resources :manager_invitations, only: [:create] + + resources :enterprise_relationships + resources :enterprise_roles + + resources :enterprise_fees do + collection do + get :for_order_cycle + post :bulk_update, :as => :bulk_update + end + end + + resources :enterprise_groups do + get :move_up + get :move_down + end + + get '/inventory', to: 'variant_overrides#index' + + get '/product_import', to: 'product_import#index' + post '/product_import', to: 'product_import#import' + post '/product_import/validate_data', to: 'product_import#validate_data', as: 'product_import_process_async' + 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 :variant_overrides do + post :bulk_update, on: :collection + post :bulk_reset, on: :collection + end + + resources :inventory_items, only: [:create, :update] + + resources :customers, only: [:index, :create, :update, :destroy, :show] + + resources :tag_rules, only: [], format: :json do + get :map_by_tag, on: :collection + end + + resource :content + + resource :accounts_and_billing_settings, only: [:edit, :update] do + collection do + get :show_methods + get :start_job + end + end + + resource :business_model_configuration, only: [:edit, :update], controller: 'business_model_configuration' + + resource :cache_settings + + resource :account, only: [:show], controller: 'account' + + resources :column_preferences, only: [], format: :json do + put :bulk_update, on: :collection + end + + resource :invoice_settings, only: [:edit, :update] + + resource :stripe_connect_settings, only: [:edit, :update] + + resources :stripe_accounts, only: [:destroy] do + get :connect, on: :collection + get :status, on: :collection + end + + resources :schedules, only: [:index, :create, :update, :destroy], format: :json + + resources :subscriptions, only: [:index, :new, :create, :edit, :update] do + put :cancel, on: :member + put :pause, on: :member + put :unpause, on: :member + end + + resources :subscription_line_items, only: [], format: :json do + post :build, on: :collection + end + + resources :proxy_orders, only: [:edit] do + put :cancel, on: :member, format: :json + put :resume, on: :member, format: :json + end + end +end