##// END OF EJS Templates
route: scm: add revision requirements for git/mercurial branches (#10026)...
Toshi MARUYAMA -
r8563:58ece4b887dc
parent child
Show More
@@ -1,404 +1,410
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 236 repository_views.connect 'projects/:id/repository/statistics',
237 237 :action => 'stats'
238 238 repository_views.connect 'projects/:id/repository/graph',
239 239 :action => 'graph'
240 240 repository_views.connect 'projects/:id/repository/revisions',
241 241 :action => 'revisions'
242 242 repository_views.connect 'projects/:id/repository/revisions.:format',
243 243 :action => 'revisions'
244 244 repository_views.connect 'projects/:id/repository/revisions/:rev',
245 245 :action => 'revision'
246 246 repository_views.connect 'projects/:id/repository/revisions/:rev/diff',
247 247 :action => 'diff'
248 248 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format',
249 249 :action => 'diff'
250 250 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path',
251 251 :action => 'entry', :format => 'raw'
252 252 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path',
253 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
253 :requirements => {
254 :action => /(browse|show|entry|changes|annotate|diff)/,
255 :rev => /[a-z0-9\.\-_]+/
256 }
254 257 repository_views.connect 'projects/:id/repository/raw/*path',
255 258 :action => 'entry', :format => 'raw'
256 259 repository_views.connect 'projects/:id/repository/:action/*path',
257 260 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
258 261
259 262 # Same routes with a repository_id
260 263 repository_views.connect 'projects/:id/repository/:repository_id/statistics',
261 264 :action => 'stats'
262 265 repository_views.connect 'projects/:id/repository/:repository_id/graph',
263 266 :action => 'graph'
264 267 repository_views.connect 'projects/:id/repository/:repository_id/revisions',
265 268 :action => 'revisions'
266 269 repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format',
267 270 :action => 'revisions'
268 271 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev',
269 272 :action => 'revision'
270 273 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff',
271 274 :action => 'diff'
272 275 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format',
273 276 :action => 'diff'
274 277 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path',
275 278 :action => 'entry', :format => 'raw'
276 279 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path',
277 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
280 :requirements => {
281 :action => /(browse|show|entry|changes|annotate|diff)/,
282 :rev => /[a-z0-9\.\-_]+/
283 }
278 284 repository_views.connect 'projects/:id/repository/:repository_id/raw/*path',
279 285 :action => 'entry', :format => 'raw'
280 286 repository_views.connect 'projects/:id/repository/:repository_id/:action/*path',
281 287 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
282 288 repository_views.connect 'projects/:id/repository/:repository_id',
283 289 :action => 'show'
284 290 end
285 291
286 292 repositories.connect 'projects/:id/repository/revision',
287 293 :action => 'revision',
288 294 :conditions => {:method => [:get, :post]}
289 295 end
290 296
291 297 # additional routes for having the file name at the end of url
292 298 map.connect 'attachments/:id/:filename', :controller => 'attachments',
293 299 :action => 'show', :id => /\d+/, :filename => /.*/,
294 300 :conditions => {:method => :get}
295 301 map.connect 'attachments/download/:id/:filename', :controller => 'attachments',
296 302 :action => 'download', :id => /\d+/, :filename => /.*/,
297 303 :conditions => {:method => :get}
298 304 map.connect 'attachments/download/:id', :controller => 'attachments',
299 305 :action => 'download', :id => /\d+/,
300 306 :conditions => {:method => :get}
301 307 map.resources :attachments, :only => [:show, :destroy]
302 308
303 309 map.resources :groups, :member => {:autocomplete_for_user => :get}
304 310 map.group_users 'groups/:id/users', :controller => 'groups',
305 311 :action => 'add_users', :id => /\d+/,
306 312 :conditions => {:method => :post}
307 313 map.group_user 'groups/:id/users/:user_id', :controller => 'groups',
308 314 :action => 'remove_user', :id => /\d+/,
309 315 :conditions => {:method => :delete}
310 316 map.connect 'groups/destroy_membership/:id', :controller => 'groups',
311 317 :action => 'destroy_membership', :id => /\d+/,
312 318 :conditions => {:method => :post}
313 319 map.connect 'groups/edit_membership/:id', :controller => 'groups',
314 320 :action => 'edit_membership', :id => /\d+/,
315 321 :conditions => {:method => :post}
316 322
317 323 map.resources :trackers, :except => :show
318 324 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
319 325 map.resources :custom_fields, :except => :show
320 326 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
321 327 map.resources :enumerations, :except => :show
322 328
323 329 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
324 330
325 331 map.connect 'mail_handler', :controller => 'mail_handler',
326 332 :action => 'index', :conditions => {:method => :post}
327 333
328 334 map.connect 'admin', :controller => 'admin', :action => 'index',
329 335 :conditions => {:method => :get}
330 336 map.connect 'admin/projects', :controller => 'admin', :action => 'projects',
331 337 :conditions => {:method => :get}
332 338 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins',
333 339 :conditions => {:method => :get}
334 340 map.connect 'admin/info', :controller => 'admin', :action => 'info',
335 341 :conditions => {:method => :get}
336 342 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email',
337 343 :conditions => {:method => :get}
338 344 map.connect 'admin/default_configuration', :controller => 'admin',
339 345 :action => 'default_configuration', :conditions => {:method => :post}
340 346
341 347 # Used by AuthSourcesControllerTest
342 348 # TODO : refactor *AuthSourcesController to remove these routes
343 349 map.connect 'auth_sources', :controller => 'auth_sources',
344 350 :action => 'index', :conditions => {:method => :get}
345 351 map.connect 'auth_sources/new', :controller => 'auth_sources',
346 352 :action => 'new', :conditions => {:method => :get}
347 353 map.connect 'auth_sources/create', :controller => 'auth_sources',
348 354 :action => 'create', :conditions => {:method => :post}
349 355 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
350 356 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
351 357 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
352 358 :action => 'test_connection', :conditions => {:method => :get}
353 359 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
354 360 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
355 361 map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
356 362 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
357 363
358 364 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources',
359 365 :action => 'index', :conditions => {:method => :get}
360 366 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources',
361 367 :action => 'new', :conditions => {:method => :get}
362 368 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources',
363 369 :action => 'create', :conditions => {:method => :post}
364 370 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources',
365 371 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
366 372 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources',
367 373 :action => 'test_connection', :conditions => {:method => :get}
368 374 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources',
369 375 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
370 376 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources',
371 377 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
372 378
373 379 map.connect 'workflows', :controller => 'workflows',
374 380 :action => 'index', :conditions => {:method => :get}
375 381 map.connect 'workflows/edit', :controller => 'workflows',
376 382 :action => 'edit', :conditions => {:method => [:get, :post]}
377 383 map.connect 'workflows/copy', :controller => 'workflows',
378 384 :action => 'copy', :conditions => {:method => [:get, :post]}
379 385
380 386 map.connect 'settings', :controller => 'settings',
381 387 :action => 'index', :conditions => {:method => :get}
382 388 map.connect 'settings/edit', :controller => 'settings',
383 389 :action => 'edit', :conditions => {:method => [:get, :post]}
384 390 map.connect 'settings/plugin/:id', :controller => 'settings',
385 391 :action => 'plugin', :conditions => {:method => [:get, :post]}
386 392
387 393 map.with_options :controller => 'sys' do |sys|
388 394 sys.connect 'sys/projects.:format',
389 395 :action => 'projects',
390 396 :conditions => {:method => :get}
391 397 sys.connect 'sys/projects/:id/repository.:format',
392 398 :action => 'create_project_repository',
393 399 :conditions => {:method => :post}
394 400 sys.connect 'sys/fetch_changesets',
395 401 :action => 'fetch_changesets',
396 402 :conditions => {:method => :get}
397 403 end
398 404
399 405 map.connect 'robots.txt', :controller => 'welcome',
400 406 :action => 'robots', :conditions => {:method => :get}
401 407
402 408 # Used for OpenID
403 409 map.root :controller => 'account', :action => 'login'
404 410 end
General Comments 0
You need to be logged in to leave comments. Login now