1 ActionController::Routing::Routes.draw do |map|
2 # Add your own custom routes here.
3 # The priority is based upon order of creation: first created -> highest priority.
5 # Here's a sample route:
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 # Keep in mind you can assign values other than :controller and :action
9 map.home '', :controller => 'welcome'
11 map.signin 'login', :controller => 'account', :action => 'login'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
17 map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
18 map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
19 map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
21 map.with_options :controller => 'timelog' do |timelog|
22 timelog.connect 'projects/:project_id/time_entries', :action => 'details'
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
25 time_details.connect 'time_entries'
26 time_details.connect 'time_entries.:format'
27 time_details.connect 'issues/:issue_id/time_entries'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
29 time_details.connect 'projects/:project_id/time_entries.:format'
30 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
31 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
35 time_report.connect 'time_entries/report'
36 time_report.connect 'time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
41 time_edit.connect 'issues/:issue_id/time_entries/new'
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
47 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
48 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
49 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
50 map.with_options :controller => 'wiki' do |wiki_routes|
51 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
52 wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
53 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
56 wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
57 wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
58 wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
62 :action => /edit|rename|destroy|preview|protect/,
63 :conditions => {:method => :post}
66 map.with_options :controller => 'messages' do |messages_routes|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
74 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
75 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
79 map.with_options :controller => 'boards' do |board_routes|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
84 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
85 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
93 map.with_options :controller => 'documents' do |document_routes|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
97 document_views.connect 'documents/:id', :action => 'show'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
106 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
107 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
108 # TODO: would look nicer as /issues/:id/preview
109 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue'
110 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
111 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
113 map.with_options :controller => 'issues' do |issues_routes|
114 issues_routes.with_options :conditions => {:method => :get} do |issues_views|
115 issues_views.connect 'issues', :action => 'index'
116 issues_views.connect 'issues.:format', :action => 'index'
117 issues_views.connect 'projects/:project_id/issues', :action => 'index'
118 issues_views.connect 'projects/:project_id/issues.:format', :action => 'index'
119 issues_views.connect 'projects/:project_id/issues/new', :action => 'new'
120 issues_views.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show'
121 issues_views.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show'
122 issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new'
123 issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/
124 issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/
125 issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/
127 issues_routes.with_options :conditions => {:method => :post} do |issues_actions|
128 issues_actions.connect 'issues', :action => 'index'
129 issues_actions.connect 'projects/:project_id/issues', :action => 'create'
130 issues_actions.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show'
131 issues_actions.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show'
132 issues_actions.connect 'issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/
133 issues_actions.connect 'issues/:id/:action', :action => /edit|destroy/, :id => /\d+/
134 issues_actions.connect 'issues.:format', :action => 'create', :format => /xml/
135 issues_actions.connect 'issues/bulk_edit', :action => 'bulk_update'
137 issues_routes.with_options :conditions => {:method => :put} do |issues_actions|
138 issues_actions.connect 'issues/:id/edit', :action => 'update', :id => /\d+/
139 issues_actions.connect 'issues/:id.:format', :action => 'update', :id => /\d+/, :format => /xml/
141 issues_routes.with_options :conditions => {:method => :delete} do |issues_actions|
142 issues_actions.connect 'issues/:id.:format', :action => 'destroy', :id => /\d+/, :format => /xml/
144 issues_routes.connect 'issues/gantt', :controller => 'gantts', :action => 'show'
145 issues_routes.connect 'issues/calendar', :controller => 'calendars', :action => 'show'
146 issues_routes.connect 'issues/:action'
149 map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
150 relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
151 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
154 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
155 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
156 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
159 map.with_options :controller => 'news' do |news_routes|
160 news_routes.with_options :conditions => {:method => :get} do |news_views|
161 news_views.connect 'news', :action => 'index'
162 news_views.connect 'projects/:project_id/news', :action => 'index'
163 news_views.connect 'projects/:project_id/news.:format', :action => 'index'
164 news_views.connect 'news.:format', :action => 'index'
165 news_views.connect 'projects/:project_id/news/new', :action => 'new'
166 news_views.connect 'news/:id', :action => 'show'
167 news_views.connect 'news/:id/edit', :action => 'edit'
169 news_routes.with_options do |news_actions|
170 news_actions.connect 'projects/:project_id/news', :action => 'new'
171 news_actions.connect 'news/:id/edit', :action => 'edit'
172 news_actions.connect 'news/:id/destroy', :action => 'destroy'
176 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
178 map.with_options :controller => 'users' do |users|
179 users.with_options :conditions => {:method => :get} do |user_views|
180 user_views.connect 'users', :action => 'index'
181 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
182 user_views.connect 'users/new', :action => 'add'
183 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
185 users.with_options :conditions => {:method => :post} do |user_actions|
186 user_actions.connect 'users', :action => 'add'
187 user_actions.connect 'users/new', :action => 'add'
188 user_actions.connect 'users/:id/edit', :action => 'edit'
189 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
190 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
191 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
195 map.with_options :controller => 'projects' do |projects|
196 projects.with_options :conditions => {:method => :get} do |project_views|
197 project_views.connect 'projects', :action => 'index'
198 project_views.connect 'projects.:format', :action => 'index'
199 project_views.connect 'projects/new', :action => 'new'
200 project_views.connect 'projects/:id', :action => 'show'
201 project_views.connect 'projects/:id.:format', :action => 'show'
202 project_views.connect 'projects/:id/:action', :action => /destroy|settings/
203 project_views.connect 'projects/:id/files', :controller => 'files', :action => 'index'
204 project_views.connect 'projects/:id/files/new', :controller => 'files', :action => 'new'
205 project_views.connect 'projects/:id/settings/:tab', :action => 'settings'
208 projects.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
209 activity.connect 'projects/:id/activity'
210 activity.connect 'projects/:id/activity.:format'
211 activity.connect 'activity', :id => nil
212 activity.connect 'activity.:format', :id => nil
215 projects.with_options :conditions => {:method => :post} do |project_actions|
216 project_actions.connect 'projects/new', :action => 'create'
217 project_actions.connect 'projects', :action => 'create'
218 project_actions.connect 'projects.:format', :action => 'create', :format => /xml/
219 project_actions.connect 'projects/:id/edit', :action => 'update'
220 project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/
221 project_actions.connect 'projects/:id/files/new', :controller => 'files', :action => 'new'
222 project_actions.connect 'projects/:id/activities/save', :controller => 'project_enumerations', :action => 'save'
225 projects.with_options :conditions => {:method => :put} do |project_actions|
226 project_actions.conditions 'projects/:id.:format', :action => 'update', :format => /xml/
229 projects.with_options :conditions => {:method => :delete} do |project_actions|
230 project_actions.conditions 'projects/:id.:format', :action => 'destroy', :format => /xml/
231 project_actions.conditions 'projects/:id/reset_activities', :controller => 'project_enumerations', :action => 'destroy'
235 map.with_options :controller => 'versions' do |versions|
236 versions.connect 'projects/:project_id/versions/new', :action => 'new'
237 versions.connect 'projects/:project_id/roadmap', :action => 'index'
238 versions.connect 'versions/:action/:id', :conditions => {:method => :get}
240 versions.with_options :conditions => {:method => :post} do |version_actions|
241 version_actions.connect 'projects/:project_id/versions', :action => 'create'
242 version_actions.connect 'versions/update/:id', :action => 'update'
243 version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed'
247 map.with_options :controller => 'issue_categories' do |categories|
248 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
251 map.with_options :controller => 'repositories' do |repositories|
252 repositories.with_options :conditions => {:method => :get} do |repository_views|
253 repository_views.connect 'projects/:id/repository', :action => 'show'
254 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
255 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
256 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
257 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
258 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
259 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
260 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
261 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
262 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
263 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
264 # TODO: why the following route is required?
265 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
266 repository_views.connect 'projects/:id/repository/:action/*path'
269 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
272 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
273 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
274 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
276 map.resources :groups
278 #left old routes at the bottom for backwards compat
279 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
280 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
281 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
282 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
283 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
284 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
285 map.connect 'projects/:project_id/news/:action', :controller => 'news'
286 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
287 map.with_options :controller => 'repositories' do |omap|
288 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
289 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
290 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
291 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
292 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
293 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
296 map.with_options :controller => 'sys' do |sys|
297 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
298 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
301 # Install the default route as the lowest priority.
302 map.connect ':controller/:action/:id'
303 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
305 map.root :controller => 'account', :action => 'login'