Files
openfoodnetwork/config/routes/spree.rb

142 lines
5.4 KiB
Ruby

# Overriding Devise routes to use our own controller
Spree::Core::Engine.routes.draw do
devise_for :spree_user,
:class_name => 'Spree::User',
:controllers => { :sessions => 'spree/user_sessions',
:registrations => 'user_registrations',
:passwords => 'user_passwords',
:confirmations => 'user_confirmations'},
:skip => [:unlocks, :omniauth_callbacks],
:path_names => { :sign_out => 'logout' },
:path_prefix => :user
resources :users, :only => [:edit, :update]
devise_scope :spree_user do
get '/login' => 'user_sessions#new', :as => :login
post '/login' => 'user_sessions#create', :as => :create_new_session
get '/logout' => 'user_sessions#destroy', :as => :logout
get '/signup' => 'user_registrations#new', :as => :signup
post '/signup' => 'user_registrations#create', :as => :registration
get '/password/recover' => 'user_passwords#new', :as => :recover_password
post '/password/recover' => 'user_passwords#create', :as => :reset_password
get '/password/change' => 'user_passwords#edit', :as => :edit_password
put '/password/change' => 'user_passwords#update', :as => :update_password
end
resource :session do
member do
get :nav_bar
end
end
resource :account, :controller => 'users'
namespace :admin do
resources :users
end
end
Spree::Core::Engine.routes.prepend do
match '/admin/reports/orders_and_distributors' => 'admin/reports#orders_and_distributors', :as => "orders_and_distributors_admin_reports", :via => [:get, :post]
match '/admin/reports/order_cycle_management' => 'admin/reports#order_cycle_management', :as => "order_cycle_management_admin_reports", :via => [:get, :post]
match '/admin/reports/packing' => 'admin/reports#packing', :as => "packing_admin_reports", :via => [:get, :post]
match '/admin/reports/group_buys' => 'admin/reports#group_buys', :as => "group_buys_admin_reports", :via => [:get, :post]
match '/admin/reports/bulk_coop' => 'admin/reports#bulk_coop', :as => "bulk_coop_admin_reports", :via => [:get, :post]
match '/admin/reports/payments' => 'admin/reports#payments', :as => "payments_admin_reports", :via => [:get, :post]
match '/admin/reports/orders_and_fulfillment' => 'admin/reports#orders_and_fulfillment', :as => "orders_and_fulfillment_admin_reports", :via => [:get, :post]
match '/admin/reports/users_and_enterprises' => 'admin/reports#users_and_enterprises', :as => "users_and_enterprises_admin_reports", :via => [:get, :post]
match '/admin/reports/sales_tax' => 'admin/reports#sales_tax', :as => "sales_tax_admin_reports", :via => [:get, :post]
match '/admin/orders/bulk_management' => 'admin/orders#bulk_management', :as => "admin_bulk_order_management"
match '/admin/reports/products_and_inventory' => 'admin/reports#products_and_inventory', :as => "products_and_inventory_admin_reports", :via => [:get, :post]
match '/admin/reports/customers' => 'admin/reports#customers', :as => "customers_admin_reports", :via => [:get, :post]
match '/admin/reports/xero_invoices' => 'admin/reports#xero_invoices', :as => "xero_invoices_admin_reports", :via => [:get, :post]
match '/admin', :to => 'admin/overview#index', :as => :admin
match '/admin/payment_methods/show_provider_preferences' => 'admin/payment_methods#show_provider_preferences', :via => :get
put 'credit_cards/new_from_token', to: 'credit_cards#new_from_token'
resources :credit_cards
namespace :api, :defaults => { :format => 'json' } do
resources :users do
get :authorise_api, on: :collection
end
resources :products do
collection do
get :managed
get :bulk_products
get :overridable
end
delete :soft_delete
post :clone
resources :variants do
delete :soft_delete
end
end
resources :variants, :only => [:index]
resources :orders do
get :managed, on: :collection
resources :shipments, :only => [:create, :update] do
member do
put :ready
put :ship
put :add
put :remove
end
end
end
resources :taxons, :only => [:index]
end
namespace :admin do
get '/search/known_users' => "search#known_users", :as => :search_known_users
get '/search/customers' => 'search#customers', :as => :search_customers
get '/search/customer_addresses' => 'search#customer_addresses', :as => :search_customer_addresses
resources :products do
get :group_buy_options, on: :member
get :seo, on: :member
post :bulk_update, :on => :collection, :as => :bulk_update
end
resources :orders do
get :invoice, on: :member
get :print, on: :member
get :print_ticket, on: :member
get :managed, on: :collection
collection do
resources :invoices, only: [:create, :show] do
get :poll
end
end
end
resources :users do
member do
put :generate_api_key
put :clear_api_key
end
end
end
resources :orders do
get :clear, :on => :collection
get :order_cycle_expired, :on => :collection
put :cancel, on: :member
end
resources :products
get '/unauthorized', :to => 'home#unauthorized', :as => :unauthorized
get '/content/cvv', :to => 'content#cvv', :as => :cvv
get '/content/*path', :to => 'content#show', :as => :content
end