diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 20:28:00 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 20:28:00 +0200 |
| commit | 4c22631a5a85b3082f0525cc2454d2bd2251922a (patch) | |
| tree | 5eb55fdf0df1b37437157b5ca089f218bacc2bec /config | |
| parent | 420506e58fdfc84f1a5bede0a01dedf0af3bb4f3 (diff) | |
Fix routes after removing the routing-filter
Diffstat (limited to 'config')
| -rw-r--r-- | config/application.rb | 5 | ||||
| -rw-r--r-- | config/environments/production.rb | 1 | ||||
| -rw-r--r-- | config/routes.rb | 28 |
3 files changed, 31 insertions, 3 deletions
diff --git a/config/application.rb b/config/application.rb index 3ddad2d..0be3396 100644 --- a/config/application.rb +++ b/config/application.rb | |||
| @@ -9,6 +9,10 @@ module Cccms | |||
| 9 | config.load_defaults 8.1 | 9 | config.load_defaults 8.1 |
| 10 | 10 | ||
| 11 | config.autoload_lib(ignore: %w[assets tasks]) | 11 | config.autoload_lib(ignore: %w[assets tasks]) |
| 12 | Rails.autoloaders.main.ignore( | ||
| 13 | Rails.root.join('lib/chaos_importer.rb'), | ||
| 14 | Rails.root.join('lib/update_importer.rb') | ||
| 15 | ) | ||
| 12 | 16 | ||
| 13 | config.time_zone = 'Berlin' | 17 | config.time_zone = 'Berlin' |
| 14 | 18 | ||
| @@ -16,5 +20,6 @@ module Cccms | |||
| 16 | config.i18n.fallbacks = { en: [:en, :de] } | 20 | config.i18n.fallbacks = { en: [:en, :de] } |
| 17 | 21 | ||
| 18 | config.filter_parameters += [:password, :password_confirmation] | 22 | config.filter_parameters += [:password, :password_confirmation] |
| 23 | config.active_storage.variant_processor = :disabled | ||
| 19 | end | 24 | end |
| 20 | end | 25 | end |
diff --git a/config/environments/production.rb b/config/environments/production.rb index f8d078e..fced949 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb | |||
| @@ -27,6 +27,7 @@ Rails.application.configure do | |||
| 27 | 27 | ||
| 28 | config.i18n.fallbacks = true | 28 | config.i18n.fallbacks = true |
| 29 | 29 | ||
| 30 | config.assets.css_compressor = nil | ||
| 30 | config.active_record.dump_schema_after_migration = false | 31 | config.active_record.dump_schema_after_migration = false |
| 31 | config.active_record.attributes_for_inspect = [ :id ] | 32 | config.active_record.attributes_for_inspect = [ :id ] |
| 32 | end | 33 | end |
diff --git a/config/routes.rb b/config/routes.rb index 9d4b41d..2df9d46 100644 --- a/config/routes.rb +++ b/config/routes.rb | |||
| @@ -1,9 +1,23 @@ | |||
| 1 | Cccms::Application.routes.draw do | 1 | Cccms::Application.routes.draw do |
| 2 | 2 | ||
| 3 | # Provides the locale prefix url scheme | 3 | # Handles bare locale root paths: /de and /en (without trailing slash). |
| 4 | scope '(:locale)', locale: ->(v) { I18n.available_locales.map(&:to_s).include?(v) } do | 4 | # Must live outside and before the scope because the scope's /*page_path |
| 5 | # catch-all would otherwise consume these before the locale segment is | ||
| 6 | # recognised. Replaces routing-filter's around_recognize hook which | ||
| 7 | # handled this transparently. | ||
| 8 | get '/:locale', to: 'content#render_page', | ||
| 9 | defaults: { page_path: ['home'] }, | ||
| 10 | constraints: { locale: /de|en/ } | ||
| 5 | 11 | ||
| 6 | root :to => 'content#render_page', :page_path => ['home'], :locale => 'de' | 12 | # All application routes are scoped under an optional two-letter locale |
| 13 | # prefix: /de/... and /en/... Both forms are valid; the prefix is omitted | ||
| 14 | # for the default locale (:de) in generated URLs via default_url_options | ||
| 15 | # in ApplicationController. This replaces the routing-filter gem. | ||
| 16 | # | ||
| 17 | # The locale regex must be kept in sync with config/application.rb | ||
| 18 | # (config.i18n.available_locales) and ApplicationController#set_locale. | ||
| 19 | # Adding a new locale requires updating all three locations. | ||
| 20 | scope '(:locale)', locale: /de|en/ do | ||
| 7 | 21 | ||
| 8 | resources :tags | 22 | resources :tags |
| 9 | resources :occurrences | 23 | resources :occurrences |
| @@ -60,6 +74,14 @@ Cccms::Application.routes.draw do | |||
| 60 | match 'galleries/*page_path' => 'content#render_gallery', :via => :get | 74 | match 'galleries/*page_path' => 'content#render_gallery', :via => :get |
| 61 | match '/*page_path' => 'content#render_page', :as => :content, :via => :get | 75 | match '/*page_path' => 'content#render_page', :as => :content, :via => :get |
| 62 | 76 | ||
| 77 | # Handles /de/ and /en/ (locale root with trailing slash). | ||
| 78 | # The bare-slash case inside the scope is distinct from the /:locale | ||
| 79 | # route above due to trailing slash handling in Rack/Rails routing. | ||
| 80 | get '/', to: 'content#render_page', defaults: { page_path: ['home'] } | ||
| 81 | |||
| 82 | # Handles / (no locale prefix — default locale :de). | ||
| 83 | root to: 'content#render_page', defaults: { page_path: ['home'] } | ||
| 84 | |||
| 63 | end | 85 | end |
| 64 | 86 | ||
| 65 | end | 87 | end |
