|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | BetterTogether::Engine.routes.draw do # rubocop:todo Metrics/BlockLength |
4 | | - # bt base path |
5 | | - scope path: 'bt' do # rubocop:todo Metrics/BlockLength |
6 | | - devise_for :users, |
7 | | - class_name: BetterTogether.user_class.to_s, |
8 | | - module: 'devise', |
9 | | - skip: %i[unlocks omniauth_callbacks], |
10 | | - path: 'users', |
11 | | - path_names: { |
12 | | - sign_in: 'sign-in', |
13 | | - sign_out: 'sign-out', |
14 | | - sign_up: 'sign-up' |
15 | | - }, |
16 | | - defaults: { format: :html } |
17 | | - |
18 | | - scope path: 'host' do |
19 | | - # Add route for the host dashboard |
20 | | - get '/', to: 'host_dashboard#index', as: 'host_dashboard' |
21 | | - |
22 | | - resources :communities do |
| 4 | + scope '(:locale)', locale: /en|fr|es/ do # rubocop:todo Metrics/BlockLength |
| 5 | + # bt base path |
| 6 | + scope path: 'bt' do # rubocop:todo Metrics/BlockLength |
| 7 | + devise_for :users, |
| 8 | + class_name: BetterTogether.user_class.to_s, |
| 9 | + module: 'devise', |
| 10 | + skip: %i[unlocks omniauth_callbacks], |
| 11 | + path: 'users', |
| 12 | + path_names: { |
| 13 | + sign_in: 'sign-in', |
| 14 | + sign_out: 'sign-out', |
| 15 | + sign_up: 'sign-up' |
| 16 | + }, |
| 17 | + defaults: { format: :html } |
| 18 | + |
| 19 | + scope path: 'host' do |
| 20 | + # Add route for the host dashboard |
| 21 | + get '/', to: 'host_dashboard#index', as: 'host_dashboard' |
| 22 | + |
| 23 | + resources :communities do |
| 24 | + resources :person_community_memberships |
| 25 | + end |
| 26 | + |
| 27 | + resources :navigation_areas do |
| 28 | + resources :navigation_items |
| 29 | + end |
| 30 | + |
| 31 | + resources :resource_permissions |
| 32 | + resources :roles |
| 33 | + |
| 34 | + resources :pages |
| 35 | + resources :people |
23 | 36 | resources :person_community_memberships |
| 37 | + resources :platforms |
| 38 | + |
| 39 | + namespace :geography do |
| 40 | + resources :continents, except: %i[new create destroy] |
| 41 | + resources :countries |
| 42 | + resources :regions |
| 43 | + resources :region_settlements |
| 44 | + resources :settlements |
| 45 | + resources :states |
| 46 | + end |
24 | 47 | end |
25 | 48 |
|
26 | | - resources :navigation_areas do |
27 | | - resources :navigation_items |
| 49 | + resources :people, only: %i[update show edit], path: :p do |
| 50 | + get 'me', to: 'people#show', as: 'my_profile' |
| 51 | + get 'me/edit', to: 'people#edit', as: 'edit_my_profile' |
28 | 52 | end |
29 | 53 |
|
30 | | - resources :resource_permissions |
31 | | - resources :roles |
32 | | - |
33 | | - resources :pages |
34 | | - resources :people |
35 | | - resources :person_community_memberships |
36 | | - resources :platforms |
37 | | - |
38 | | - namespace :geography do |
39 | | - resources :continents, except: %i[new create destroy] |
40 | | - resources :countries |
41 | | - resources :regions |
42 | | - resources :region_settlements |
43 | | - resources :settlements |
44 | | - resources :states |
| 54 | + resources :wizards, only: [:show] do |
| 55 | + # Custom route for wizard steps |
| 56 | + get ':wizard_step_definition_id', to: 'wizard_steps#show', as: :step |
| 57 | + patch ':wizard_step_definition_id', to: 'wizard_steps#update' |
| 58 | + # Add other HTTP methbetter-together/community-engine-rails/app/controllers/better_together/bt |
45 | 59 | end |
46 | | - end |
47 | 60 |
|
48 | | - resources :people, only: %i[update show edit], path: :p do |
49 | | - get 'me', to: 'people#show', as: 'my_profile' |
50 | | - get 'me/edit', to: 'people#edit', as: 'edit_my_profile' |
| 61 | + scope path: :w do |
| 62 | + scope path: :setup_wizard do |
| 63 | + get '/', to: 'setup_wizard#show', defaults: { wizard_id: 'host_setup' }, as: :setup_wizard |
| 64 | + get '/platform_details', to: 'setup_wizard_steps#platform_details', |
| 65 | + defaults: { wizard_id: 'host_setup', wizard_step_definition_id: :platform_details }, |
| 66 | + as: :setup_wizard_step_platform_details |
| 67 | + post 'create_host_platform', to: 'setup_wizard_steps#create_host_platform', |
| 68 | + defaults: { |
| 69 | + wizard_id: 'host_setup', |
| 70 | + wizard_step_definition_id: :platform_details |
| 71 | + }, |
| 72 | + as: :setup_wizard_step_create_host_platform |
| 73 | + get 'admin_creation', to: 'setup_wizard_steps#admin_creation', |
| 74 | + defaults: { wizard_id: 'host_setup', wizard_step_definition_id: :admin_creation }, |
| 75 | + as: :setup_wizard_step_admin_creation |
| 76 | + post 'create_admin', to: 'setup_wizard_steps#create_admin', |
| 77 | + defaults: { wizard_id: 'host_setup', wizard_step_definition_id: :admin_creation }, |
| 78 | + as: :setup_wizard_step_create_admin |
| 79 | + end |
| 80 | + end |
51 | 81 | end |
52 | 82 |
|
53 | | - resources :wizards, only: [:show] do |
54 | | - # Custom route for wizard steps |
55 | | - get ':wizard_step_definition_id', to: 'wizard_steps#show', as: :step |
56 | | - patch ':wizard_step_definition_id', to: 'wizard_steps#update' |
57 | | - # Add other HTTP methbetter-together/community-engine-rails/app/controllers/better_together/bt |
| 83 | + if Rails.env.development? |
| 84 | + get '/404', to: 'application#render_404' |
| 85 | + get '/500', to: 'application#render_500' |
58 | 86 | end |
59 | 87 |
|
60 | | - scope path: :w do |
61 | | - scope path: :setup_wizard do |
62 | | - get '/', to: 'setup_wizard#show', defaults: { wizard_id: 'host_setup' }, as: :setup_wizard |
63 | | - get '/platform_details', to: 'setup_wizard_steps#platform_details', |
64 | | - defaults: { wizard_id: 'host_setup', wizard_step_definition_id: :platform_details }, |
65 | | - as: :setup_wizard_step_platform_details |
66 | | - post 'create_host_platform', to: 'setup_wizard_steps#create_host_platform', |
67 | | - defaults: { |
68 | | - wizard_id: 'host_setup', |
69 | | - wizard_step_definition_id: :platform_details |
70 | | - }, |
71 | | - as: :setup_wizard_step_create_host_platform |
72 | | - get 'admin_creation', to: 'setup_wizard_steps#admin_creation', |
73 | | - defaults: { wizard_id: 'host_setup', wizard_step_definition_id: :admin_creation }, |
74 | | - as: :setup_wizard_step_admin_creation |
75 | | - post 'create_admin', to: 'setup_wizard_steps#create_admin', |
76 | | - defaults: { wizard_id: 'host_setup', wizard_step_definition_id: :admin_creation }, |
77 | | - as: :setup_wizard_step_create_admin |
78 | | - end |
79 | | - end |
80 | | - end |
| 88 | + # Catch-all route |
| 89 | + get '*path', to: 'pages#show', as: 'render_page', constraints: lambda { |req| |
| 90 | + !req.xhr? && req.format.html? |
| 91 | + } |
81 | 92 |
|
82 | | - if Rails.env.development? |
83 | | - get '/404', to: 'application#render_404' |
84 | | - get '/500', to: 'application#render_500' |
| 93 | + get '/bt' => 'static_pages#community_engine' |
85 | 94 | end |
86 | | - |
87 | | - # Catch-all route |
88 | | - get '*path', to: 'pages#show', as: 'render_page', constraints: lambda { |req| |
89 | | - !req.xhr? && req.format.html? |
90 | | - } |
91 | | - |
92 | | - get '/bt' => 'static_pages#community_engine' |
93 | | - |
94 | 95 | # TODO: Re-enable the API routes when the API is in full use and actively being maintained to prevent security issues. |
95 | 96 | # namespace :bt do |
96 | 97 | # namespace :api, defaults: { format: :json } do |
|
0 commit comments