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