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