You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

91 lines
2.5 KiB

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
post "go_again", to: "players#go_again", as: :go_again
scope "stages/:id", constraints: { id: /\d+/ } do
get "", to: "stages#show", as: :stage
post "flip", to: "stages#flip"
get "reveal", to: "stages#reveal"
post "pick(/:option)", to: "stages#pick"
get "result", to: "stages#result"
post "next", to: "stages#next"
post "bonus", to: "stages#try_bonus"
get "bonus", to: "stages#bonus"
post "pick_bonus(/:option)", to: "stages#pick_bonus"
post "get_bonus_point", to: "stages#get_bonus_point"
end
get "game_over", to: "stages#game_over"
get "score", to: "stages#score"
get "", to: "languages#show"
# get "*url", to: "site#page", constraints: lambda { |req| req.path.exclude?("storage") }
end
namespace :api do
namespace :v1 do
get "leaderboard", to: "leaderboard#index"
end
end
put "update_locale", to: "languages#update"
# Defines the root path route ("/")
root "languages#index"
end