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