summaryrefslogtreecommitdiff
path: root/config/routes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/routes.rb')
-rw-r--r--config/routes.rb119
1 files changed, 84 insertions, 35 deletions
diff --git a/config/routes.rb b/config/routes.rb
index c2590bd2..2df9d463 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,38 +1,87 @@
1ActionController::Routing::Routes.draw do |map| 1Cccms::Application.routes.draw do
2
3 # Handles bare locale root paths: /de and /en (without trailing slash).
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/ }
11
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
21
22 resources :tags
23 resources :occurrences
24 resources :events
25
26 resources :pages do
27 member do
28 get :preview
29 put :sort_images
30 end
31 end
32
33 resources :nodes do
34 member do
35 put :unlock
36 put :publish
37 end
38
39 resources :revisions do
40 collection do
41 post :diff
42 end
43 member do
44 put :restore
45 end
46 end
47 end
48
49 scope '/admin' do
50 resources :assets
51 end
52
53 match '/logout' => 'sessions#destroy', :as => :logout, :via => :delete
54 match '/login' => 'sessions#new', :as => :login, :via => :get
55 match 'admin' => 'admin#index', :as => :admin, :via => :get
56 match 'admin/search' => 'admin#search', :as => :admin_search, :via => :get
57 match 'search' => 'search#index', :as => :search, :via => :get
58
59 resources :users
60
61 resources :menu_items do
62 member do
63 post :sort
64 end
65 end
66
67 resource :session
68
69 get 'rss/updates', :to => 'rss#updates', :as => :rss
70 get 'rss/updates.:format', :to => 'rss#updates', :as => :rss_feed,
71 :constraints => { :format => /xml|rdf/ }
72 get 'rss/recent_changes', :to => 'rss#recent_changes'
73
74 match 'galleries/*page_path' => 'content#render_gallery', :via => :get
75 match '/*page_path' => 'content#render_page', :as => :content, :via => :get
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'] }
2 84
3 map.filter :locale
4
5 map.root(
6 :locale => 'de',
7 :controller => 'content',
8 :action => 'render_page',
9 :page_path => ['home']
10 )
11 map.resources :assets
12 map.resources :tags
13 map.resources :occurrences
14 map.resources :events
15 map.resources :pages, :member => {:preview => :get, :sort_images => :put}
16 map.resources :nodes, :member => {:publish => :put, :unlock => :put} do |node|
17 node.resources :revisions, :member => {:restore => :put}, :collection => {:diff => :post}
18 end 85 end
19 map.logout '/logout', :controller => 'sessions', :action => 'destroy' 86
20 map.login '/login', :controller => 'sessions', :action => 'new'
21 map.admin_search 'admin/search', :controller => 'admin', :action => 'search'
22 map.search 'search', :controller => "search", :action => 'index'
23 map.resources :users
24 map.resources :menu_items, :member => {:sort => :post}
25 map.resource :session
26
27 map.rss 'rss/:action', :controller => 'rss'
28 map.rss 'rss/:action.:format', :controller => 'rss'
29
30 map.connect ':controller/:action/:id'
31 map.connect ':controller/:action/:id.:format'
32
33 map.connect 'galleries/*page_path',
34 :controller => 'content', :action => 'render_gallery'
35
36 map.content '/*page_path',
37 :controller => 'content', :action => 'render_page'
38end 87end