1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
Cccms::Application.routes.draw do
# Handles bare locale root paths: /de and /en (without trailing slash).
# Must live outside and before the scope because the scope's /*page_path
# catch-all would otherwise consume these before the locale segment is
# recognised. Replaces routing-filter's around_recognize hook which
# handled this transparently.
get '/:locale', to: 'content#render_page',
defaults: { page_path: ['home'] },
constraints: { locale: /de|en/ }
# All application routes are scoped under an optional two-letter locale
# prefix: /de/... and /en/... Both forms are valid; the prefix is omitted
# for the default locale (:de) in generated URLs via default_url_options
# in ApplicationController. This replaces the routing-filter gem.
#
# The locale regex must be kept in sync with config/application.rb
# (config.i18n.available_locales) and ApplicationController#set_locale.
# Adding a new locale requires updating all three locations.
scope '(:locale)', locale: /de|en/ do
resources :tags
resources :occurrences
resources :events
resources :pages do
member do
get :preview
put :sort_images
end
end
resources :nodes do
member do
put :unlock
put :publish
end
resources :revisions do
collection do
post :diff
end
member do
put :restore
end
end
end
scope '/admin' do
resources :assets
end
match '/logout' => 'sessions#destroy', :as => :logout, :via => :delete
match '/login' => 'sessions#new', :as => :login, :via => :get
match 'admin' => 'admin#index', :as => :admin, :via => :get
match 'admin/search' => 'admin#search', :as => :admin_search, :via => :get
match 'search' => 'search#index', :as => :search, :via => :get
resources :users
resources :menu_items do
member do
post :sort
end
end
resource :session
get 'rss/updates', :to => 'rss#updates', :as => :rss
get 'rss/updates.:format', :to => 'rss#updates', :as => :rss_feed,
:constraints => { :format => /xml|rdf/ }
get 'rss/recent_changes', :to => 'rss#recent_changes'
match 'galleries/*page_path' => 'content#render_gallery', :via => :get
match '/*page_path' => 'content#render_page', :as => :content, :via => :get
# Handles /de/ and /en/ (locale root with trailing slash).
# The bare-slash case inside the scope is distinct from the /:locale
# route above due to trailing slash handling in Rack/Rails routing.
get '/', to: 'content#render_page', defaults: { page_path: ['home'] }
# Handles / (no locale prefix — default locale :de).
root to: 'content#render_page', defaults: { page_path: ['home'] }
end
end
|