##// END OF EJS Templates
route: move attachments resources after matching...
Toshi MARUYAMA -
r8319:5127f3dcbc19
parent child
Show More
@@ -1,377 +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 183 project.resources :versions, :shallow => true,
184 184 :collection => {:close_completed => :put},
185 185 :member => {:status_by => :post}
186 186 project.resources :news, :shallow => true
187 187 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get}
188 188 project.resources :queries, :only => [:new, :create]
189 189 project.resources :issue_categories, :shallow => true
190 190 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
191 191 project.resources :boards
192 192
193 193 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
194 194 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
195 195 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
196 196 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
197 197 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
198 198 project.resources :wiki, :except => [:new, :create], :member => {
199 199 :rename => [:get, :post],
200 200 :history => :get,
201 201 :preview => :any,
202 202 :protect => :post,
203 203 :add_attachment => :post
204 204 }, :collection => {
205 205 :export => :get,
206 206 :date_index => :get
207 207 }
208 208
209 209 end
210 210
211 211 # TODO: port to be part of the resources route(s)
212 212 map.with_options :conditions => {:method => :get} do |project_views|
213 213 project_views.connect 'projects/:id/settings/:tab',
214 214 :controller => 'projects', :action => 'settings'
215 215 project_views.connect 'projects/:project_id/issues/:copy_from/copy',
216 216 :controller => 'issues', :action => 'new'
217 217 end
218 218
219 219 map.with_options :controller => 'activities', :action => 'index',
220 220 :conditions => {:method => :get} do |activity|
221 221 activity.connect 'projects/:id/activity'
222 222 activity.connect 'projects/:id/activity.:format'
223 223 activity.connect 'activity', :id => nil
224 224 activity.connect 'activity.:format', :id => nil
225 225 end
226 226
227 227 map.with_options :controller => 'repositories' do |repositories|
228 228 repositories.with_options :conditions => {:method => :get} do |repository_views|
229 229 repository_views.connect 'projects/:id/repository', :action => 'show'
230 230 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
231 231 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
232 232
233 233 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
234 234 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
235 235 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
236 236 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
237 237 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
238 238 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry',
239 239 :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
240 240 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path',
241 241 :requirements => { :rev => /[a-z0-9\.\-_]+/ }
242 242
243 243 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
244 244 repository_views.connect 'projects/:id/repository/browse/*path', :action => 'browse'
245 245 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
246 246 repository_views.connect 'projects/:id/repository/changes/*path', :action => 'changes'
247 247 repository_views.connect 'projects/:id/repository/annotate/*path', :action => 'annotate'
248 248 repository_views.connect 'projects/:id/repository/diff/*path', :action => 'diff'
249 249 repository_views.connect 'projects/:id/repository/show/*path', :action => 'show'
250 250 repository_views.connect 'projects/:id/repository/graph', :action => 'graph'
251 251 end
252 252
253 253 repositories.connect 'projects/:id/repository/revision', :action => 'revision',
254 254 :conditions => {:method => [:get, :post]}
255 255
256 256 repositories.connect 'projects/:id/repository/committers', :action => 'committers',
257 257 :conditions => {:method => [:get, :post]}
258 258 repositories.connect 'projects/:id/repository/edit', :action => 'edit',
259 259 :conditions => {:method => :post}
260 260 repositories.connect 'projects/:id/repository/destroy', :action => 'destroy',
261 261 :conditions => {:method => :post}
262 262 end
263 263
264 map.resources :attachments, :only => [:show, :destroy]
265 264 # additional routes for having the file name at the end of url
266 265 map.connect 'attachments/:id/:filename', :controller => 'attachments',
267 266 :action => 'show', :id => /\d+/, :filename => /.*/,
268 267 :conditions => {:method => :get}
269 268 map.connect 'attachments/download/:id/:filename', :controller => 'attachments',
270 269 :action => 'download', :id => /\d+/, :filename => /.*/,
271 270 :conditions => {:method => :get}
272 271 map.connect 'attachments/download/:id', :controller => 'attachments',
273 272 :action => 'download', :id => /\d+/,
274 273 :conditions => {:method => :get}
274 map.resources :attachments, :only => [:show, :destroy]
275 275
276 276 map.resources :groups, :member => {:autocomplete_for_user => :get}
277 277 map.group_users 'groups/:id/users', :controller => 'groups',
278 278 :action => 'add_users', :id => /\d+/,
279 279 :conditions => {:method => :post}
280 280 map.group_user 'groups/:id/users/:user_id', :controller => 'groups',
281 281 :action => 'remove_user', :id => /\d+/,
282 282 :conditions => {:method => :delete}
283 283 map.connect 'groups/destroy_membership/:id', :controller => 'groups',
284 284 :action => 'destroy_membership', :id => /\d+/,
285 285 :conditions => {:method => :post}
286 286 map.connect 'groups/edit_membership/:id', :controller => 'groups',
287 287 :action => 'edit_membership', :id => /\d+/,
288 288 :conditions => {:method => :post}
289 289
290 290 map.resources :trackers, :except => :show
291 291 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
292 292 map.resources :custom_fields, :except => :show
293 293 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
294 294 map.resources :enumerations, :except => :show
295 295
296 296 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
297 297
298 298 map.connect 'mail_handler', :controller => 'mail_handler',
299 299 :action => 'index', :conditions => {:method => :post}
300 300
301 301 map.connect 'admin', :controller => 'admin', :action => 'index',
302 302 :conditions => {:method => :get}
303 303 map.connect 'admin/projects', :controller => 'admin', :action => 'projects',
304 304 :conditions => {:method => :get}
305 305 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins',
306 306 :conditions => {:method => :get}
307 307 map.connect 'admin/info', :controller => 'admin', :action => 'info',
308 308 :conditions => {:method => :get}
309 309 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email',
310 310 :conditions => {:method => :get}
311 311 map.connect 'admin/default_configuration', :controller => 'admin',
312 312 :action => 'default_configuration', :conditions => {:method => :post}
313 313
314 314 # Used by AuthSourcesControllerTest
315 315 # TODO : refactor *AuthSourcesController to remove these routes
316 316 map.connect 'auth_sources', :controller => 'auth_sources',
317 317 :action => 'index', :conditions => {:method => :get}
318 318 map.connect 'auth_sources/new', :controller => 'auth_sources',
319 319 :action => 'new', :conditions => {:method => :get}
320 320 map.connect 'auth_sources/create', :controller => 'auth_sources',
321 321 :action => 'create', :conditions => {:method => :post}
322 322 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
323 323 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
324 324 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
325 325 :action => 'test_connection', :conditions => {:method => :get}
326 326 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
327 327 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
328 328 map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
329 329 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
330 330
331 331 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources',
332 332 :action => 'index', :conditions => {:method => :get}
333 333 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources',
334 334 :action => 'new', :conditions => {:method => :get}
335 335 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources',
336 336 :action => 'create', :conditions => {:method => :post}
337 337 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources',
338 338 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
339 339 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources',
340 340 :action => 'test_connection', :conditions => {:method => :get}
341 341 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources',
342 342 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
343 343 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources',
344 344 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
345 345
346 346 map.connect 'workflows', :controller => 'workflows',
347 347 :action => 'index', :conditions => {:method => :get}
348 348 map.connect 'workflows/edit', :controller => 'workflows',
349 349 :action => 'edit', :conditions => {:method => [:get, :post]}
350 350 map.connect 'workflows/copy', :controller => 'workflows',
351 351 :action => 'copy', :conditions => {:method => [:get, :post]}
352 352
353 353 map.connect 'settings', :controller => 'settings',
354 354 :action => 'index', :conditions => {:method => :get}
355 355 map.connect 'settings/edit', :controller => 'settings',
356 356 :action => 'edit', :conditions => {:method => [:get, :post]}
357 357 map.connect 'settings/plugin/:id', :controller => 'settings',
358 358 :action => 'plugin', :conditions => {:method => [:get, :post]}
359 359
360 360 map.with_options :controller => 'sys' do |sys|
361 361 sys.connect 'sys/projects.:format',
362 362 :action => 'projects',
363 363 :conditions => {:method => :get}
364 364 sys.connect 'sys/projects/:id/repository.:format',
365 365 :action => 'create_project_repository',
366 366 :conditions => {:method => :post}
367 367 sys.connect 'sys/fetch_changesets',
368 368 :action => 'fetch_changesets',
369 369 :conditions => {:method => :get}
370 370 end
371 371
372 372 map.connect 'robots.txt', :controller => 'welcome',
373 373 :action => 'robots', :conditions => {:method => :get}
374 374
375 375 # Used for OpenID
376 376 map.root :controller => 'account', :action => 'login'
377 377 end
General Comments 0
You need to be logged in to leave comments. Login now