##// END OF EJS Templates
Explicitly declare all routes and deactivate default route....
Etienne Massip -
r8042:7ba57e517ba0
parent child
Show More
@@ -76,7 +76,7 class IssueRelationsController < ApplicationController
76 76 @relation.destroy
77 77
78 78 respond_to do |format|
79 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
79 format.html { redirect_to issue_path } # TODO : does this really work since @issue is always nil? What is it useful to?
80 80 format.js { render(:update) {|page| page.remove "relation-#{@relation.id}"} }
81 81 format.api { head :ok }
82 82 end
@@ -31,6 +31,6
31 31 <% end if @blocks['right'] %>
32 32 </div>
33 33
34 <%= context_menu :controller => 'issues', :action => 'context_menu' %>
34 <%= context_menu issues_context_menu_path %>
35 35
36 36 <% html_title(l(:label_my_page)) -%>
@@ -5,7 +5,7
5 5 <div class="contextual">
6 6 <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %>
7 7 <%= link_to(l(:label_issue_view_all), { :controller => 'issues' }) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %>
8 <%= link_to(l(:label_overall_spent_time), { :controller => 'time_entries' }) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
8 <%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
9 9 <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%>
10 10 </div>
11 11
@@ -6,31 +6,40 ActionController::Routing::Routes.draw do |map|
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 map.home '', :controller => 'welcome'
9 map.home '', :controller => 'welcome', :conditions => {:method => :get}
10 10
11 map.signin 'login', :controller => 'account', :action => 'login'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
11 map.signin 'login', :controller => 'account', :action => 'login', :conditions => {:method => [:get, :post]}
12 map.signout 'logout', :controller => 'account', :action => 'logout', :conditions => {:method => :get}
13 map.connect 'account/register', :controller => 'account', :action => 'register', :conditions => {:method => [:get, :post]}
14 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', :conditions => {:method => [:get, :post]}
15 map.connect 'account/login', :controller => 'account', :action => 'login', :conditions => {:method => [:get, :post]}
16 map.connect 'account/logout', :controller => 'account', :action => 'logout', :conditions => {:method => :get}
17 map.connect 'account/activate', :controller => 'account', :action => 'activate', :conditions => {:method => :get}
13 18
14 19 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
16 20
21 map.connect 'help/:ctrl/:page', :controller => 'help', :conditions => {:method => :get}
22
23 map.connect '/time_entries/destroy',
24 :controller => 'timelog', :action => 'destroy', :conditions => { :method => :delete }
17 25 map.time_entries_context_menu '/time_entries/context_menu',
18 26 :controller => 'context_menus', :action => 'time_entries'
19 27
20 28 map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
21 29
22 30 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
23 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
24 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
31 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => [:get, :post]}
25 32
26 33 map.with_options :controller => 'messages' do |messages_routes|
27 34 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
28 35 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
29 36 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
37 messages_views.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
30 38 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
31 39 end
32 40 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
33 41 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
42 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
34 43 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
35 44 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
36 45 end
@@ -45,6 +54,8 ActionController::Routing::Routes.draw do |map|
45 54 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
46 55 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
47 56 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
57 map.connect '/journals/diff', :controller => 'journals', :action => 'diff'
58 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', :id => /\d+/, :conditions => { :method => [:get, :post] }
48 59
49 60 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
50 61 gantts_routes.connect '/projects/:project_id/issues/gantt'
@@ -62,6 +73,17 ActionController::Routing::Routes.draw do |map|
62 73 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
63 74 end
64 75
76 map.connect 'my/account', :controller => 'my', :action => 'account', :conditions => {:method => [:get, :post]}
77 map.connect 'my/page', :controller => 'my', :action => 'page', :conditions => {:method => :get}
78 map.connect 'my', :controller => 'my', :action => 'index', :conditions => {:method => :get} # Redirects to my/page
79 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :conditions => {:method => :post}
80 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :conditions => {:method => :post}
81 map.connect 'my/password', :controller => 'my', :action => 'password', :conditions => {:method => [:get, :post]}
82 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', :conditions => {:method => :get}
83 map.connect 'my/add_block', :controller => 'my', :action => 'add_block', :conditions => {:method => :post}
84 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', :conditions => {:method => :post}
85 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :conditions => {:method => :post}
86
65 87 map.resources :issues, :collection => {:bulk_edit => :get, :bulk_update => :post} do |issues|
66 88 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
67 89 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
@@ -69,7 +91,10 ActionController::Routing::Routes.draw do |map|
69 91 # Bulk deletion
70 92 map.connect '/issues', :controller => 'issues', :action => 'destroy', :conditions => {:method => :delete}
71 93
72 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
94 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new', :conditions => { :method => :post }
95 map.connect 'members/edit/:id', :controller => 'members', :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
96 map.connect 'members/destroy/:id', :controller => 'members', :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }
97 map.connect 'members/autocomplete_for_member/:id', :controller => 'members', :action => 'autocomplete_for_member', :conditions => { :method => :post }
73 98
74 99 map.resources :users
75 100 map.with_options :controller => 'users' do |users|
@@ -87,6 +112,11 ActionController::Routing::Routes.draw do |map|
87 112 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
88 113 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
89 114
115 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', :conditions => {:method => [:get, :post]}
116 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :conditions => {:method => :post}
117 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', :conditions => {:method => :post}
118 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :conditions => {:method => :post}
119
90 120 map.resources :projects, :member => {
91 121 :copy => [:get, :post],
92 122 :settings => :get,
@@ -153,39 +183,100 ActionController::Routing::Routes.draw do |map|
153 183 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
154 184 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
155 185 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
156 # TODO: why the following route is required?
186 repository_views.connect 'projects/:id/repository/browse/*path', :action => 'browse'
157 187 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
158 repository_views.connect 'projects/:id/repository/:action/*path'
188 repository_views.connect 'projects/:id/repository/changes/*path', :action => 'changes'
189 repository_views.connect 'projects/:id/repository/annotate/*path', :action => 'annotate'
190 repository_views.connect 'projects/:id/repository/diff/*path', :action => 'diff'
191 repository_views.connect 'projects/:id/repository/graph', :action => 'graph'
192 # repository_views.connect 'projects/:id/repository/:action/*path'
159 193 end
160 194
161 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
195 repositories.connect 'projects/:id/repository/revision', :action => 'revision', :conditions => {:method => [:get, :post]}
196 repositories.connect 'projects/:id/repository/committers', :action => 'committers', :conditions => {:method => [:get, :post]}
197 repositories.connect 'projects/:id/repository/edit', :action => 'edit', :conditions => {:method => :post}
198 repositories.connect 'projects/:id/repository/destroy', :action => 'destroy', :conditions => {:method => :post}
199 # repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
162 200 end
163
201
164 202 map.resources :attachments, :only => [:show, :destroy]
165 203 # additional routes for having the file name at the end of url
166 204 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
167 205 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
206 map.connect 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/
168 207
169 208 map.resources :groups, :member => {:autocomplete_for_user => :get}
170 209 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
171 210 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
211 map.connect 'groups/add_users/:id', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
212 map.connect 'groups/remove_user/:id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :post}
213 map.connect 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :conditions => {:method => :post}
214 map.connect 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :conditions => {:method => :post}
172 215
173 216 map.resources :trackers, :except => :show
174 217 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
175 218 map.resources :custom_fields, :except => :show
176 219 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
177 220
178 #left old routes at the bottom for backwards compat
179 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
221 map.connect 'custom_fields', :controller => 'custom_fields', :action => 'index', :conditions => {:method => :get}
222 map.connect 'custom_fields/new', :controller => 'custom_fields', :action => 'new', :conditions => {:method => [:get, :post]}
223 map.connect 'custom_fields/edit/:id', :controller => 'custom_fields', :action => 'edit', :id => /\d+/, :conditions => {:method => [:get, :post]}
224 map.connect 'custom_fields/destroy/:id', :controller => 'custom_fields', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
225
226 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
227
228 map.connect 'mail_handler', :controller => 'mail_handler', :action => 'index', :conditions => {:method => :post}
229
230 map.connect 'admin', :controller => 'admin', :action => 'index', :conditions => {:method => :get}
231 map.connect 'admin/projects', :controller => 'admin', :action => 'projects', :conditions => {:method => :get}
232 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', :conditions => {:method => :get}
233 map.connect 'admin/info', :controller => 'admin', :action => 'info', :conditions => {:method => :get}
234 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', :conditions => {:method => :get}
235 map.connect 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :conditions => {:method => :post}
236
237 # Used by AuthSourcesControllerTest
238 # TODO : refactor *AuthSourcesController to remove these routes
239 map.connect 'auth_sources', :controller => 'auth_sources', :action => 'index', :conditions => {:method => :get}
240 map.connect 'auth_sources/new', :controller => 'auth_sources', :action => 'new', :conditions => {:method => :get}
241 map.connect 'auth_sources/create', :controller => 'auth_sources', :action => 'create', :conditions => {:method => :post}
242 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
243 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources', :action => 'test_connection', :conditions => {:method => :get}
244 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
245 map.connect 'auth_sources/update/:id', :controller => 'auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
246
247 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources', :action => 'index', :conditions => {:method => :get}
248 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources', :action => 'new', :conditions => {:method => :get}
249 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources', :action => 'create', :conditions => {:method => :post}
250 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
251 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources', :action => 'test_connection', :conditions => {:method => :get}
252 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
253 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
254 map.connect 'workflows', :controller => 'workflows', :action => 'index', :conditions => {:method => :get}
255 map.connect 'workflows/edit', :controller => 'workflows', :action => 'edit', :conditions => {:method => [:get, :post]}
256 map.connect 'workflows/copy', :controller => 'workflows', :action => 'copy', :conditions => {:method => [:get, :post]}
257 map.connect 'enumerations', :controller => 'enumerations', :action => 'index', :conditions => {:method => :get}
258 map.connect 'enumerations/new', :controller => 'enumerations', :action => 'new', :conditions => {:method => :get}
259 map.connect 'enumerations/create', :controller => 'enumerations', :action => 'create', :conditions => {:method => :post}
260 map.connect 'enumerations/edit/:id', :controller => 'enumerations', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
261 map.connect 'enumerations/update/:id', :controller => 'enumerations', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
262 map.connect 'enumerations/destroy/:id', :controller => 'enumerations', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
263 map.connect 'settings', :controller => 'settings', :action => 'index', :conditions => {:method => :get}
264 map.connect 'settings/edit', :controller => 'settings', :action => 'edit', :conditions => {:method => [:get, :post]}
265 map.connect 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :conditions => {:method => [:get, :post]}
180 266
181 267 map.with_options :controller => 'sys' do |sys|
182 268 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
183 269 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
270 sys.connect 'sys/fetch_changesets', :action => 'fetch_changesets', :conditions => {:method => :get}
184 271 end
185 272
273 #left old routes at the bottom for backwards compat
274 # map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
275
186 276 # Install the default route as the lowest priority.
187 map.connect ':controller/:action/:id'
188 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
277 # map.connect ':controller/:action/:id'
278 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots', :conditions => {:method => :get}
279
189 280 # Used for OpenID
190 281 map.root :controller => 'account', :action => 'login'
191 282 end
@@ -468,13 +468,6 class ProjectsControllerTest < ActionController::TestCase
468 468 :attributes => {:name => 'project[enabled_module_names][]', :value => 'issue_tracking'}
469 469 end
470 470
471 def test_get_copy_without_project
472 @request.session[:user_id] = 1 # admin
473 get :copy
474 assert_response :redirect
475 assert_redirected_to :controller => 'admin', :action => 'projects'
476 end
477
478 471 def test_post_copy_should_copy_requested_items
479 472 @request.session[:user_id] = 1 # admin
480 473 CustomField.delete_all
@@ -32,7 +32,7 class AdminTest < ActionController::IntegrationTest
32 32 get "/users/new"
33 33 assert_response :success
34 34 assert_template "users/new"
35 post "/users/create",
35 post "/users",
36 36 :user => { :login => "psmith", :firstname => "Paul",
37 37 :lastname => "Smith", :mail => "psmith@somenet.foo",
38 38 :language => "en", :password => "psmith09",
@@ -53,7 +53,7 class AdminTest < ActionController::IntegrationTest
53 53 end
54 54
55 55 test "Add a user as an anonymous user should fail" do
56 post '/users/create',
56 post '/users',
57 57 :user => { :login => 'psmith', :firstname => 'Paul'},
58 58 :password => "psmith09", :password_confirmation => "psmith09"
59 59 assert_response :redirect
@@ -26,7 +26,7 class ProjectsTest < ActionController::IntegrationTest
26 26 get "admin/projects"
27 27 assert_response :success
28 28 assert_template "admin/projects"
29 post "projects/archive", :id => 1
29 post "projects/1/archive"
30 30 assert_redirected_to "/admin/projects"
31 31 assert !Project.find(1).active?
32 32
@@ -35,7 +35,7 class ProjectsTest < ActionController::IntegrationTest
35 35 get "projects/#{subproject.id}"
36 36 assert_response 403
37 37
38 post "projects/unarchive", :id => 1
38 post "projects/1/unarchive"
39 39 assert_redirected_to "/admin/projects"
40 40 assert Project.find(1).active?
41 41 get "projects/1"
General Comments 0
You need to be logged in to leave comments. Login now