Rails.application.routes.draw do
|
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
|
|
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
|
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
|
# get "up" => "rails/health#show", as: :rails_health_check
|
|
|
|
get "admin", to: redirect("/admin/en")
|
|
|
|
namespace :admin do
|
|
scope ":locale", constraints: { locale: /en|zh|hr|cs|da|nl|fi|fr|fr-CA|de|hu|it|ja|ko|nb|pl|pt|ro|sr|sk|sl|es|sv|uk/ } do
|
|
# Assets
|
|
resources :assets do
|
|
collection do
|
|
post :upload
|
|
end
|
|
end
|
|
|
|
# Nodes
|
|
resources :nodes do
|
|
member do
|
|
get :children
|
|
get :tree
|
|
end
|
|
collection do
|
|
get :tree
|
|
patch :sort
|
|
patch :toggle
|
|
end
|
|
resources :assets, only: [ :index ]
|
|
resources :attachments, only: [ :new ]
|
|
end
|
|
|
|
# Users
|
|
resources :users
|
|
|
|
# Root
|
|
root to: "nodes#index"
|
|
end
|
|
|
|
# Cache
|
|
delete "cache/clear", to: "admin#clear_cache"
|
|
|
|
resources :sessions, path: "login", only: [ :index, :create, :destroy ]
|
|
get "logout", to: "sessions#destroy", as: "logout"
|
|
|
|
# 2 step auth
|
|
post "login/verify", to: "sessions#verify"
|
|
get "login/verification", to: "sessions#verification"
|
|
end
|
|
|
|
scope ":locale", constraints: { locale: /en|zh|hr|cs|da|nl|fi|fr|fr-CA|de|hu|it|ja|ko|nb|pl|pt|ro|sr|sk|sl|es|sv|uk/ } do
|
|
post "start", to: "players#create", as: "start"
|
|
|
|
get "stages/:id", to: "stages#show", constraints: { id: /\d+/ }, as: :stage
|
|
post "stages/:id/flip", to: "stages#flip", constraints: { id: /\d+/ }, as: :flip_stage
|
|
post "stages/:id/choose", to: "stages#choose", constraints: { id: /\d+/ }, as: :choose_stage
|
|
|
|
get "", to: "languages#show"
|
|
# get "*url", to: "site#page", constraints: lambda { |req| req.path.exclude?("storage") }
|
|
end
|
|
|
|
put "update_locale", to: "languages#update"
|
|
|
|
# Defines the root path route ("/")
|
|
root "languages#index"
|
|
end
|