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