Files
openfoodnetwork/config/routes.rb
luisramos0 921105301c Move angular-templates route and controller into Web engine
The route and controller were in the main app and the views in the engine, with this commit they stay all inside the engine
This is done to keep it simple and remove the unnecessary dependency between main app and engine
If we use this mechanism in the future for other things in the main app or other engines, we can find a way to extract/abstract this
2018-09-26 12:39:51 +01:00

123 lines
3.4 KiB
Ruby

Openfoodnetwork::Application.routes.draw do
root :to => 'home#index'
# Redirects from old URLs avoid server errors and helps search engines
get "/enterprises", to: redirect("/")
get "/products", to: redirect("/")
get "/products/:id", to: redirect("/")
get "/t/products/:id", to: redirect("/")
get "/about_us", to: redirect(ContentConfig.footer_about_url)
get "/login", to: redirect("/#/login")
get "/discourse/login", to: "discourse_sso#login"
get "/discourse/sso", to: "discourse_sso#sso"
get "/map", to: "map#index", as: :map
get "/sell", to: "home#sell", as: :sell
get "/register", to: "registration#index", as: :registration
get "/register/auth", to: "registration#authenticate", as: :registration_auth
post "/user/registered_email", to: "spree/users#registered_email"
# Redirects to global website
get "/connect", to: redirect("https://openfoodnetwork.org/#{ENV['DEFAULT_COUNTRY_CODE'].andand.downcase}/connect/")
get "/learn", to: redirect("https://openfoodnetwork.org/#{ENV['DEFAULT_COUNTRY_CODE'].andand.downcase}/learn/")
get "/cart", :to => "spree/orders#edit", :as => :cart
put "/cart", :to => "spree/orders#update", :as => :update_cart
put "/cart/empty", :to => 'spree/orders#empty', :as => :empty_cart
resource :cart, controller: "cart" do
post :populate
end
resource :shop, controller: "shop" do
get :products
post :order_cycle
get :order_cycle
get :changeable_orders_alert
end
resources :producers, only: [:index] do
collection do
get :signup
end
end
resources :shops, only: [:index] do
collection do
get :signup
end
end
resources :line_items, only: [:destroy] do
get :bought, on: :collection
end
resources :groups, only: [:index, :show] do
collection do
get :signup
end
end
namespace :stripe do
resources :callbacks, only: [:index]
resources :webhooks, only: [:create]
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
get 'embedded_shopfront/shopfront_session', to: 'application#shopfront_session'
post 'embedded_shopfront/enable', to: 'application#enable_embedded_styles'
post 'embedded_shopfront/disable', to: 'application#disable_embedded_styles'
resources :enterprises do
collection do
post :search
get :check_permalink
end
member do
get :shop
get :relatives
end
end
get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop'
get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL
namespace :api do
resources :enterprises do
post :update_image, on: :member
get :managed, on: :collection
get :accessible, on: :collection
resource :logo, only: [:destroy]
resource :promo_image, only: [:destroy]
end
resources :order_cycles do
get :managed, on: :collection
get :accessible, on: :collection
end
resource :status do
get :job_queue
end
resources :customers, only: [:index, :update]
post '/product_images/:product_id', to: 'product_images#update_product_image'
end
get 'sitemap.xml', to: 'sitemap#index', defaults: { format: 'xml' }
# Mount Web engine routes
mount Web::Engine, :at => '/'
# Mount Spree's routes
mount Spree::Core::Engine, :at => '/'
end