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