2014-11-06 14:46:59 +01:00
|
|
|
Rails.application.routes.draw do
|
2015-09-22 07:13:35 +02:00
|
|
|
devise_for :users, controllers: { omniauth_callbacks: "callbacks" }
|
2014-12-09 17:17:11 +01:00
|
|
|
|
2015-01-06 20:18:01 +01:00
|
|
|
devise_scope :user do
|
2015-09-22 07:13:35 +02:00
|
|
|
get 'sign_out', to: 'devise/sessions#destroy', as: :destroy_user_session
|
2015-10-07 15:06:01 +02:00
|
|
|
get 'sign_in', to: 'welcome#token_sign_in'
|
2015-01-06 20:18:01 +01:00
|
|
|
unauthenticated :user do
|
2015-03-25 17:49:37 +01:00
|
|
|
root to: 'welcome#index'
|
2015-01-09 12:31:14 +01:00
|
|
|
end
|
2015-03-03 20:11:50 +01:00
|
|
|
|
|
|
|
authenticated :user, ->(u) { u.koelkast? } do
|
|
|
|
root to: 'orders#overview', as: :koelkast_root
|
|
|
|
end
|
|
|
|
|
|
|
|
authenticated :user, ->(u) { !u.koelkast? } do
|
|
|
|
root to: 'users#show', as: :user_root
|
2015-01-06 20:18:01 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-04 23:47:34 +01:00
|
|
|
resources :users, only: [:show, :update] do
|
2015-09-14 20:26:16 +02:00
|
|
|
resources :orders, only: [:new, :create, :destroy]
|
2015-09-07 21:15:16 +02:00
|
|
|
member do
|
2015-09-22 20:06:50 +02:00
|
|
|
get 'quickpay' => 'users#quickpay'
|
2015-09-07 21:15:16 +02:00
|
|
|
get 'dagschotel/edit' => 'users#edit_dagschotel', as: 'edit_dagschotel'
|
|
|
|
end
|
2014-11-25 15:27:12 +01:00
|
|
|
end
|
2014-11-06 18:30:53 +01:00
|
|
|
|
2015-09-28 21:51:40 +02:00
|
|
|
resources :products, only: [:create, :index, :edit, :update] do
|
2015-10-27 22:09:01 +01:00
|
|
|
resources :barcodes, only: :create
|
2015-09-20 21:21:18 +02:00
|
|
|
collection do
|
2015-09-25 14:24:32 +02:00
|
|
|
get 'barcode' => 'products#barcode', as: :barcode
|
|
|
|
post 'barcode' => 'products#load_barcode', as: :load_barcode
|
2015-09-20 21:21:18 +02:00
|
|
|
end
|
|
|
|
end
|
2015-02-09 17:06:24 +01:00
|
|
|
|
2015-10-27 22:09:01 +01:00
|
|
|
resources :barcodes, only: [:show, :index, :destroy]
|
|
|
|
|
2015-01-06 20:33:11 +01:00
|
|
|
get 'overview' => 'orders#overview', as: "orders"
|
2015-11-30 18:20:54 +01:00
|
|
|
|
|
|
|
namespace :guest do
|
|
|
|
resources :orders, only: [:new, :create]
|
|
|
|
end
|
2014-11-06 14:46:59 +01:00
|
|
|
end
|