##// END OF EJS Templates
route: repository: move :repository_id routes before non :repository_id routes...
Toshi MARUYAMA -
r8598:f49d8d8c5f5f
parent child
Show More
@@ -1,410 +1,413
1 1 ActionController::Routing::Routes.draw do |map|
2 2 # Add your own custom routes here.
3 3 # The priority is based upon order of creation: first created -> highest priority.
4 4
5 5 # Here's a sample route:
6 6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 7 # Keep in mind you can assign values other than :controller and :action
8 8
9 9 map.home '', :controller => 'welcome', :conditions => {:method => :get}
10 10
11 11 map.signin 'login', :controller => 'account', :action => 'login',
12 12 :conditions => {:method => [:get, :post]}
13 13 map.signout 'logout', :controller => 'account', :action => 'logout',
14 14 :conditions => {:method => :get}
15 15 map.connect 'account/register', :controller => 'account', :action => 'register',
16 16 :conditions => {:method => [:get, :post]}
17 17 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password',
18 18 :conditions => {:method => [:get, :post]}
19 19 map.connect 'account/activate', :controller => 'account', :action => 'activate',
20 20 :conditions => {:method => :get}
21 21
22 22 map.connect 'projects/:id/wiki', :controller => 'wikis',
23 23 :action => 'edit', :conditions => {:method => :post}
24 24 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis',
25 25 :action => 'destroy', :conditions => {:method => [:get, :post]}
26 26
27 27 map.with_options :controller => 'messages' do |messages_routes|
28 28 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
29 29 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
30 30 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
31 31 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
32 32 end
33 33 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
34 34 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
35 35 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
36 36 messages_actions.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
37 37 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
38 38 messages_actions.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
39 39 messages_actions.connect 'boards/:board_id/topics/:id/destroy', :action => 'destroy'
40 40 end
41 41 end
42 42
43 43 # Misc issue routes. TODO: move into resources
44 44 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes',
45 45 :action => 'issues', :conditions => { :method => :get }
46 46 # TODO: would look nicer as /issues/:id/preview
47 47 map.preview_issue '/issues/preview/:id', :controller => 'previews',
48 48 :action => 'issue'
49 49 map.issues_context_menu '/issues/context_menu',
50 50 :controller => 'context_menus', :action => 'issues'
51 51
52 52 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
53 53 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new',
54 54 :id => /\d+/, :conditions => { :method => :post }
55 55
56 56 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff',
57 57 :id => /\d+/, :conditions => { :method => :get }
58 58 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit',
59 59 :id => /\d+/, :conditions => { :method => [:get, :post] }
60 60
61 61 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
62 62 gantts_routes.connect '/projects/:project_id/issues/gantt'
63 63 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
64 64 gantts_routes.connect '/issues/gantt.:format'
65 65 end
66 66
67 67 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
68 68 calendars_routes.connect '/projects/:project_id/issues/calendar'
69 69 calendars_routes.connect '/issues/calendar'
70 70 end
71 71
72 72 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
73 73 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
74 74 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
75 75 end
76 76
77 77 map.connect 'my/account', :controller => 'my', :action => 'account',
78 78 :conditions => {:method => [:get, :post]}
79 79 map.connect 'my/page', :controller => 'my', :action => 'page',
80 80 :conditions => {:method => :get}
81 81 # Redirects to my/page
82 82 map.connect 'my', :controller => 'my', :action => 'index',
83 83 :conditions => {:method => :get}
84 84 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key',
85 85 :conditions => {:method => :post}
86 86 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key',
87 87 :conditions => {:method => :post}
88 88 map.connect 'my/password', :controller => 'my', :action => 'password',
89 89 :conditions => {:method => [:get, :post]}
90 90 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout',
91 91 :conditions => {:method => :get}
92 92 map.connect 'my/add_block', :controller => 'my', :action => 'add_block',
93 93 :conditions => {:method => :post}
94 94 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block',
95 95 :conditions => {:method => :post}
96 96 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks',
97 97 :conditions => {:method => :post}
98 98
99 99 map.connect 'projects/:id/members/new', :controller => 'members',
100 100 :action => 'new', :conditions => { :method => :post }
101 101 map.connect 'members/edit/:id', :controller => 'members',
102 102 :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
103 103 map.connect 'members/destroy/:id', :controller => 'members',
104 104 :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }
105 105 map.connect 'members/autocomplete_for_member/:id', :controller => 'members',
106 106 :action => 'autocomplete_for_member', :conditions => { :method => :post }
107 107
108 108 map.with_options :controller => 'users' do |users|
109 109 users.user_membership 'users/:id/memberships/:membership_id',
110 110 :action => 'edit_membership',
111 111 :conditions => {:method => :put}
112 112 users.connect 'users/:id/memberships/:membership_id',
113 113 :action => 'destroy_membership',
114 114 :conditions => {:method => :delete}
115 115 users.user_memberships 'users/:id/memberships',
116 116 :action => 'edit_membership',
117 117 :conditions => {:method => :post}
118 118 end
119 119 map.resources :users
120 120
121 121 # For nice "roadmap" in the url for the index action
122 122 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
123 123
124 124 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
125 125 map.connect 'news/:id/comments', :controller => 'comments',
126 126 :action => 'create', :conditions => {:method => :post}
127 127 map.connect 'news/:id/comments/:comment_id', :controller => 'comments',
128 128 :action => 'destroy', :conditions => {:method => :delete}
129 129
130 130 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new',
131 131 :conditions => {:method => :get}
132 132 map.connect 'watchers', :controller=> 'watchers', :action => 'create',
133 133 :conditions => {:method => :post}
134 134 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy',
135 135 :conditions => {:method => :post}
136 136 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch',
137 137 :conditions => {:method => :post}
138 138 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch',
139 139 :conditions => {:method => :post}
140 140 map.connect 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user',
141 141 :conditions => {:method => :get}
142 142
143 143 # TODO: port to be part of the resources route(s)
144 144 map.with_options :conditions => {:method => :get} do |project_views|
145 145 project_views.connect 'projects/:id/settings/:tab',
146 146 :controller => 'projects', :action => 'settings'
147 147 project_views.connect 'projects/:project_id/issues/:copy_from/copy',
148 148 :controller => 'issues', :action => 'new'
149 149 end
150 150
151 151 map.resources :projects, :member => {
152 152 :copy => [:get, :post],
153 153 :settings => :get,
154 154 :modules => :post,
155 155 :archive => :post,
156 156 :unarchive => :post
157 157 } do |project|
158 158 project.resource :enumerations, :controller => 'project_enumerations',
159 159 :only => [:update, :destroy]
160 160 # issue form update
161 161 project.issue_form 'issues/new', :controller => 'issues',
162 162 :action => 'new', :conditions => {:method => [:post, :put]}
163 163 project.resources :issues, :only => [:index, :new, :create] do |issues|
164 164 issues.resources :time_entries, :controller => 'timelog',
165 165 :collection => {:report => :get}
166 166 end
167 167
168 168 project.resources :files, :only => [:index, :new, :create]
169 169 project.resources :versions, :shallow => true,
170 170 :collection => {:close_completed => :put},
171 171 :member => {:status_by => :post}
172 172 project.resources :news, :shallow => true
173 173 project.resources :time_entries, :controller => 'timelog',
174 174 :collection => {:report => :get}
175 175 project.resources :queries, :only => [:new, :create]
176 176 project.resources :issue_categories, :shallow => true
177 177 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
178 178 project.resources :boards
179 179 project.resources :repositories, :shallow => true, :except => [:index, :show],
180 180 :member => {:committers => [:get, :post]}
181 181
182 182 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
183 183 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
184 184 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
185 185 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
186 186 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
187 187 project.resources :wiki, :except => [:new, :create], :member => {
188 188 :rename => [:get, :post],
189 189 :history => :get,
190 190 :preview => :any,
191 191 :protect => :post,
192 192 :add_attachment => :post
193 193 }, :collection => {
194 194 :export => :get,
195 195 :date_index => :get
196 196 }
197 197 end
198 198
199 199 map.connect 'news', :controller => 'news', :action => 'index'
200 200 map.connect 'news.:format', :controller => 'news', :action => 'index'
201 201
202 202 map.resources :queries, :except => [:show]
203 203 map.resources :issues,
204 204 :collection => {:bulk_edit => [:get, :post], :bulk_update => :post} do |issues|
205 205 issues.resources :time_entries, :controller => 'timelog',
206 206 :collection => {:report => :get}
207 207 issues.resources :relations, :shallow => true,
208 208 :controller => 'issue_relations',
209 209 :only => [:index, :show, :create, :destroy]
210 210 end
211 211 # Bulk deletion
212 212 map.connect '/issues', :controller => 'issues', :action => 'destroy',
213 213 :conditions => {:method => :delete}
214 214
215 215 map.connect '/time_entries/destroy',
216 216 :controller => 'timelog', :action => 'destroy',
217 217 :conditions => { :method => :delete }
218 218 map.time_entries_context_menu '/time_entries/context_menu',
219 219 :controller => 'context_menus', :action => 'time_entries'
220 220
221 221 map.resources :time_entries, :controller => 'timelog',
222 222 :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
223 223
224 224 map.with_options :controller => 'activities', :action => 'index',
225 225 :conditions => {:method => :get} do |activity|
226 226 activity.connect 'projects/:id/activity'
227 227 activity.connect 'projects/:id/activity.:format'
228 228 activity.connect 'activity', :id => nil
229 229 activity.connect 'activity.:format', :id => nil
230 230 end
231 231
232 232 map.with_options :controller => 'repositories' do |repositories|
233 233 repositories.with_options :conditions => {:method => :get} do |repository_views|
234 234 repository_views.connect 'projects/:id/repository',
235 235 :action => 'show'
236
237 repository_views.connect 'projects/:id/repository/:repository_id/statistics',
238 :action => 'stats'
239 repository_views.connect 'projects/:id/repository/:repository_id/graph',
240 :action => 'graph'
241
236 242 repository_views.connect 'projects/:id/repository/statistics',
237 243 :action => 'stats'
238 244 repository_views.connect 'projects/:id/repository/graph',
239 245 :action => 'graph'
240 repository_views.connect 'projects/:id/repository/revisions',
246
247 repository_views.connect 'projects/:id/repository/:repository_id/revisions',
241 248 :action => 'revisions'
242 repository_views.connect 'projects/:id/repository/revisions.:format',
249 repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format',
243 250 :action => 'revisions'
244 repository_views.connect 'projects/:id/repository/revisions/:rev',
251 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev',
245 252 :action => 'revision'
246 repository_views.connect 'projects/:id/repository/revisions/:rev/diff',
253 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff',
247 254 :action => 'diff'
248 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format',
255 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format',
249 256 :action => 'diff'
250 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path',
257 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path',
251 258 :action => 'entry', :format => 'raw'
252 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path',
259 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path',
253 260 :requirements => {
254 261 :action => /(browse|show|entry|changes|annotate|diff)/,
255 262 :rev => /[a-z0-9\.\-_]+/
256 263 }
257 repository_views.connect 'projects/:id/repository/raw/*path',
264 repository_views.connect 'projects/:id/repository/:repository_id/raw/*path',
258 265 :action => 'entry', :format => 'raw'
259 repository_views.connect 'projects/:id/repository/:action/*path',
266 repository_views.connect 'projects/:id/repository/:repository_id/:action/*path',
260 267 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
261 268
262 # Same routes with a repository_id
263 repository_views.connect 'projects/:id/repository/:repository_id/statistics',
264 :action => 'stats'
265 repository_views.connect 'projects/:id/repository/:repository_id/graph',
266 :action => 'graph'
267 repository_views.connect 'projects/:id/repository/:repository_id/revisions',
269 repository_views.connect 'projects/:id/repository/revisions',
268 270 :action => 'revisions'
269 repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format',
271 repository_views.connect 'projects/:id/repository/revisions.:format',
270 272 :action => 'revisions'
271 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev',
273 repository_views.connect 'projects/:id/repository/revisions/:rev',
272 274 :action => 'revision'
273 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff',
275 repository_views.connect 'projects/:id/repository/revisions/:rev/diff',
274 276 :action => 'diff'
275 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format',
277 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format',
276 278 :action => 'diff'
277 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path',
279 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path',
278 280 :action => 'entry', :format => 'raw'
279 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path',
281 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path',
280 282 :requirements => {
281 283 :action => /(browse|show|entry|changes|annotate|diff)/,
282 284 :rev => /[a-z0-9\.\-_]+/
283 285 }
284 repository_views.connect 'projects/:id/repository/:repository_id/raw/*path',
286 repository_views.connect 'projects/:id/repository/raw/*path',
285 287 :action => 'entry', :format => 'raw'
286 repository_views.connect 'projects/:id/repository/:repository_id/:action/*path',
288 repository_views.connect 'projects/:id/repository/:action/*path',
287 289 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
290
288 291 repository_views.connect 'projects/:id/repository/:repository_id',
289 292 :action => 'show'
290 293 end
291 294
292 295 repositories.connect 'projects/:id/repository/revision',
293 296 :action => 'revision',
294 297 :conditions => {:method => [:get, :post]}
295 298 end
296 299
297 300 # additional routes for having the file name at the end of url
298 301 map.connect 'attachments/:id/:filename', :controller => 'attachments',
299 302 :action => 'show', :id => /\d+/, :filename => /.*/,
300 303 :conditions => {:method => :get}
301 304 map.connect 'attachments/download/:id/:filename', :controller => 'attachments',
302 305 :action => 'download', :id => /\d+/, :filename => /.*/,
303 306 :conditions => {:method => :get}
304 307 map.connect 'attachments/download/:id', :controller => 'attachments',
305 308 :action => 'download', :id => /\d+/,
306 309 :conditions => {:method => :get}
307 310 map.resources :attachments, :only => [:show, :destroy]
308 311
309 312 map.resources :groups, :member => {:autocomplete_for_user => :get}
310 313 map.group_users 'groups/:id/users', :controller => 'groups',
311 314 :action => 'add_users', :id => /\d+/,
312 315 :conditions => {:method => :post}
313 316 map.group_user 'groups/:id/users/:user_id', :controller => 'groups',
314 317 :action => 'remove_user', :id => /\d+/,
315 318 :conditions => {:method => :delete}
316 319 map.connect 'groups/destroy_membership/:id', :controller => 'groups',
317 320 :action => 'destroy_membership', :id => /\d+/,
318 321 :conditions => {:method => :post}
319 322 map.connect 'groups/edit_membership/:id', :controller => 'groups',
320 323 :action => 'edit_membership', :id => /\d+/,
321 324 :conditions => {:method => :post}
322 325
323 326 map.resources :trackers, :except => :show
324 327 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
325 328 map.resources :custom_fields, :except => :show
326 329 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
327 330 map.resources :enumerations, :except => :show
328 331
329 332 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
330 333
331 334 map.connect 'mail_handler', :controller => 'mail_handler',
332 335 :action => 'index', :conditions => {:method => :post}
333 336
334 337 map.connect 'admin', :controller => 'admin', :action => 'index',
335 338 :conditions => {:method => :get}
336 339 map.connect 'admin/projects', :controller => 'admin', :action => 'projects',
337 340 :conditions => {:method => :get}
338 341 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins',
339 342 :conditions => {:method => :get}
340 343 map.connect 'admin/info', :controller => 'admin', :action => 'info',
341 344 :conditions => {:method => :get}
342 345 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email',
343 346 :conditions => {:method => :get}
344 347 map.connect 'admin/default_configuration', :controller => 'admin',
345 348 :action => 'default_configuration', :conditions => {:method => :post}
346 349
347 350 # Used by AuthSourcesControllerTest
348 351 # TODO : refactor *AuthSourcesController to remove these routes
349 352 map.connect 'auth_sources', :controller => 'auth_sources',
350 353 :action => 'index', :conditions => {:method => :get}
351 354 map.connect 'auth_sources/new', :controller => 'auth_sources',
352 355 :action => 'new', :conditions => {:method => :get}
353 356 map.connect 'auth_sources/create', :controller => 'auth_sources',
354 357 :action => 'create', :conditions => {:method => :post}
355 358 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
356 359 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
357 360 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
358 361 :action => 'test_connection', :conditions => {:method => :get}
359 362 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
360 363 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
361 364 map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
362 365 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
363 366
364 367 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources',
365 368 :action => 'index', :conditions => {:method => :get}
366 369 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources',
367 370 :action => 'new', :conditions => {:method => :get}
368 371 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources',
369 372 :action => 'create', :conditions => {:method => :post}
370 373 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources',
371 374 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
372 375 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources',
373 376 :action => 'test_connection', :conditions => {:method => :get}
374 377 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources',
375 378 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
376 379 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources',
377 380 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
378 381
379 382 map.connect 'workflows', :controller => 'workflows',
380 383 :action => 'index', :conditions => {:method => :get}
381 384 map.connect 'workflows/edit', :controller => 'workflows',
382 385 :action => 'edit', :conditions => {:method => [:get, :post]}
383 386 map.connect 'workflows/copy', :controller => 'workflows',
384 387 :action => 'copy', :conditions => {:method => [:get, :post]}
385 388
386 389 map.connect 'settings', :controller => 'settings',
387 390 :action => 'index', :conditions => {:method => :get}
388 391 map.connect 'settings/edit', :controller => 'settings',
389 392 :action => 'edit', :conditions => {:method => [:get, :post]}
390 393 map.connect 'settings/plugin/:id', :controller => 'settings',
391 394 :action => 'plugin', :conditions => {:method => [:get, :post]}
392 395
393 396 map.with_options :controller => 'sys' do |sys|
394 397 sys.connect 'sys/projects.:format',
395 398 :action => 'projects',
396 399 :conditions => {:method => :get}
397 400 sys.connect 'sys/projects/:id/repository.:format',
398 401 :action => 'create_project_repository',
399 402 :conditions => {:method => :post}
400 403 sys.connect 'sys/fetch_changesets',
401 404 :action => 'fetch_changesets',
402 405 :conditions => {:method => :get}
403 406 end
404 407
405 408 map.connect 'robots.txt', :controller => 'welcome',
406 409 :action => 'robots', :conditions => {:method => :get}
407 410
408 411 # Used for OpenID
409 412 map.root :controller => 'account', :action => 'login'
410 413 end
General Comments 0
You need to be logged in to leave comments. Login now