##// END OF EJS Templates
Use a shallow block instead of the :shallow option that ignores routes scope (#14023)....
Jean-Philippe Lang -
r11621:eab2c74e10a5
parent child
Show More
@@ -1,347 +1,355
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 RedmineApp::Application.routes.draw do
18 RedmineApp::Application.routes.draw do
19 root :to => 'welcome#index', :as => 'home'
19 root :to => 'welcome#index', :as => 'home'
20
20
21 match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
21 match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
22 match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
22 match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
23 match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
23 match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
24 match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
24 match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
25 match 'account/activate', :to => 'account#activate', :via => :get
25 match 'account/activate', :to => 'account#activate', :via => :get
26
26
27 match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
27 match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
28 match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
28 match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
29 match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put]
29 match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put]
30 match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
30 match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
31
31
32 match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
32 match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
33 match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
33 match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
34
34
35 match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
35 match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
36 get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
36 get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
37 match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
37 match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
38 get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
38 get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
39
39
40 post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message'
40 post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message'
41 post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
41 post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
42 post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
42 post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
43 post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
43 post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
44
44
45 # Misc issue routes. TODO: move into resources
45 # Misc issue routes. TODO: move into resources
46 match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
46 match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
47 match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post]
47 match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post]
48 match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get
48 match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get
49 match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
49 match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
50
50
51 match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get
51 match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get
52 match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
52 match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
53
53
54 get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
54 get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
55 get '/issues/gantt', :to => 'gantts#show'
55 get '/issues/gantt', :to => 'gantts#show'
56
56
57 get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar'
57 get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar'
58 get '/issues/calendar', :to => 'calendars#show'
58 get '/issues/calendar', :to => 'calendars#show'
59
59
60 get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
60 get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
61 get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
61 get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
62
62
63 match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
63 match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
64 match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
64 match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
65 match 'my/page', :controller => 'my', :action => 'page', :via => :get
65 match 'my/page', :controller => 'my', :action => 'page', :via => :get
66 match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
66 match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
67 match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
67 match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
68 match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
68 match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
69 match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
69 match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
70 match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
70 match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
71 match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
71 match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
72 match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
72 match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
73 match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
73 match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
74
74
75 resources :users
75 resources :users
76 match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership'
76 match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership'
77 match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
77 match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
78 match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
78 match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
79
79
80 post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
80 post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
81 delete 'watchers/watch', :to => 'watchers#unwatch'
81 delete 'watchers/watch', :to => 'watchers#unwatch'
82 get 'watchers/new', :to => 'watchers#new'
82 get 'watchers/new', :to => 'watchers#new'
83 post 'watchers', :to => 'watchers#create'
83 post 'watchers', :to => 'watchers#create'
84 post 'watchers/append', :to => 'watchers#append'
84 post 'watchers/append', :to => 'watchers#append'
85 delete 'watchers', :to => 'watchers#destroy'
85 delete 'watchers', :to => 'watchers#destroy'
86 get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user'
86 get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user'
87 # Specific routes for issue watchers API
87 # Specific routes for issue watchers API
88 post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
88 post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
89 delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
89 delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
90
90
91 resources :projects do
91 resources :projects do
92 member do
92 member do
93 get 'settings(/:tab)', :action => 'settings', :as => 'settings'
93 get 'settings(/:tab)', :action => 'settings', :as => 'settings'
94 post 'modules'
94 post 'modules'
95 post 'archive'
95 post 'archive'
96 post 'unarchive'
96 post 'unarchive'
97 post 'close'
97 post 'close'
98 post 'reopen'
98 post 'reopen'
99 match 'copy', :via => [:get, :post]
99 match 'copy', :via => [:get, :post]
100 end
100 end
101
101
102 resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
102 shallow do
103 collection do
103 resources :memberships, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
104 get 'autocomplete'
104 collection do
105 get 'autocomplete'
106 end
105 end
107 end
106 end
108 end
107
109
108 resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
110 resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
109
111
110 get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue'
112 get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue'
111 resources :issues, :only => [:index, :new, :create] do
113 resources :issues, :only => [:index, :new, :create] do
112 resources :time_entries, :controller => 'timelog' do
114 resources :time_entries, :controller => 'timelog' do
113 collection do
115 collection do
114 get 'report'
116 get 'report'
115 end
117 end
116 end
118 end
117 end
119 end
118 # issue form update
120 # issue form update
119 match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
121 match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
120
122
121 resources :files, :only => [:index, :new, :create]
123 resources :files, :only => [:index, :new, :create]
122
124
123 resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
125 resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
124 collection do
126 collection do
125 put 'close_completed'
127 put 'close_completed'
126 end
128 end
127 end
129 end
128 get 'versions.:format', :to => 'versions#index'
130 get 'versions.:format', :to => 'versions#index'
129 get 'roadmap', :to => 'versions#index', :format => false
131 get 'roadmap', :to => 'versions#index', :format => false
130 get 'versions', :to => 'versions#index'
132 get 'versions', :to => 'versions#index'
131
133
132 resources :news, :except => [:show, :edit, :update, :destroy]
134 resources :news, :except => [:show, :edit, :update, :destroy]
133 resources :time_entries, :controller => 'timelog' do
135 resources :time_entries, :controller => 'timelog' do
134 get 'report', :on => :collection
136 get 'report', :on => :collection
135 end
137 end
136 resources :queries, :only => [:new, :create]
138 resources :queries, :only => [:new, :create]
137 resources :issue_categories, :shallow => true
139 shallow do
140 resources :issue_categories
141 end
138 resources :documents, :except => [:show, :edit, :update, :destroy]
142 resources :documents, :except => [:show, :edit, :update, :destroy]
139 resources :boards
143 resources :boards
140 resources :repositories, :shallow => true, :except => [:index, :show] do
144 shallow do
141 member do
145 resources :repositories, :except => [:index, :show] do
142 match 'committers', :via => [:get, :post]
146 member do
147 match 'committers', :via => [:get, :post]
148 end
143 end
149 end
144 end
150 end
145
151
146 match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
152 match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
147 resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
153 resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
148 member do
154 member do
149 get 'rename'
155 get 'rename'
150 post 'rename'
156 post 'rename'
151 get 'history'
157 get 'history'
152 get 'diff'
158 get 'diff'
153 match 'preview', :via => [:post, :put]
159 match 'preview', :via => [:post, :put]
154 post 'protect'
160 post 'protect'
155 post 'add_attachment'
161 post 'add_attachment'
156 end
162 end
157 collection do
163 collection do
158 get 'export'
164 get 'export'
159 get 'date_index'
165 get 'date_index'
160 end
166 end
161 end
167 end
162 match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
168 match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
163 get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
169 get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
164 delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
170 delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
165 get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
171 get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
166 get 'wiki/:id/:version/diff', :to => 'wiki#diff'
172 get 'wiki/:id/:version/diff', :to => 'wiki#diff'
167 end
173 end
168
174
169 resources :issues do
175 resources :issues do
170 collection do
176 collection do
171 match 'bulk_edit', :via => [:get, :post]
177 match 'bulk_edit', :via => [:get, :post]
172 post 'bulk_update'
178 post 'bulk_update'
173 end
179 end
174 resources :time_entries, :controller => 'timelog' do
180 resources :time_entries, :controller => 'timelog' do
175 collection do
181 collection do
176 get 'report'
182 get 'report'
177 end
183 end
178 end
184 end
179 resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
185 shallow do
186 resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
187 end
180 end
188 end
181 match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
189 match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
182
190
183 resources :queries, :except => [:show]
191 resources :queries, :except => [:show]
184
192
185 resources :news, :only => [:index, :show, :edit, :update, :destroy]
193 resources :news, :only => [:index, :show, :edit, :update, :destroy]
186 match '/news/:id/comments', :to => 'comments#create', :via => :post
194 match '/news/:id/comments', :to => 'comments#create', :via => :post
187 match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
195 match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
188
196
189 resources :versions, :only => [:show, :edit, :update, :destroy] do
197 resources :versions, :only => [:show, :edit, :update, :destroy] do
190 post 'status_by', :on => :member
198 post 'status_by', :on => :member
191 end
199 end
192
200
193 resources :documents, :only => [:show, :edit, :update, :destroy] do
201 resources :documents, :only => [:show, :edit, :update, :destroy] do
194 post 'add_attachment', :on => :member
202 post 'add_attachment', :on => :member
195 end
203 end
196
204
197 match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
205 match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
198
206
199 resources :time_entries, :controller => 'timelog', :except => :destroy do
207 resources :time_entries, :controller => 'timelog', :except => :destroy do
200 collection do
208 collection do
201 get 'report'
209 get 'report'
202 get 'bulk_edit'
210 get 'bulk_edit'
203 post 'bulk_update'
211 post 'bulk_update'
204 end
212 end
205 end
213 end
206 match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
214 match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
207 # TODO: delete /time_entries for bulk deletion
215 # TODO: delete /time_entries for bulk deletion
208 match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
216 match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
209
217
210 get 'projects/:id/activity', :to => 'activities#index'
218 get 'projects/:id/activity', :to => 'activities#index'
211 get 'projects/:id/activity.:format', :to => 'activities#index'
219 get 'projects/:id/activity.:format', :to => 'activities#index'
212 get 'activity', :to => 'activities#index'
220 get 'activity', :to => 'activities#index'
213
221
214 # repositories routes
222 # repositories routes
215 get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
223 get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
216 get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
224 get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
217
225
218 get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
226 get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
219 :to => 'repositories#changes'
227 :to => 'repositories#changes'
220
228
221 get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
229 get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
222 get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
230 get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
223 post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
231 post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
224 delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
232 delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
225 get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
233 get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
226 get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
234 get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
227 :controller => 'repositories',
235 :controller => 'repositories',
228 :format => false,
236 :format => false,
229 :constraints => {
237 :constraints => {
230 :action => /(browse|show|entry|raw|annotate|diff)/,
238 :action => /(browse|show|entry|raw|annotate|diff)/,
231 :rev => /[a-z0-9\.\-_]+/
239 :rev => /[a-z0-9\.\-_]+/
232 }
240 }
233
241
234 get 'projects/:id/repository/statistics', :to => 'repositories#stats'
242 get 'projects/:id/repository/statistics', :to => 'repositories#stats'
235 get 'projects/:id/repository/graph', :to => 'repositories#graph'
243 get 'projects/:id/repository/graph', :to => 'repositories#graph'
236
244
237 get 'projects/:id/repository/changes(/*path(.:ext))',
245 get 'projects/:id/repository/changes(/*path(.:ext))',
238 :to => 'repositories#changes'
246 :to => 'repositories#changes'
239
247
240 get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
248 get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
241 get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
249 get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
242 get 'projects/:id/repository/revision', :to => 'repositories#revision'
250 get 'projects/:id/repository/revision', :to => 'repositories#revision'
243 post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
251 post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
244 delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
252 delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
245 get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
253 get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
246 :controller => 'repositories',
254 :controller => 'repositories',
247 :format => false,
255 :format => false,
248 :constraints => {
256 :constraints => {
249 :action => /(browse|show|entry|raw|annotate|diff)/,
257 :action => /(browse|show|entry|raw|annotate|diff)/,
250 :rev => /[a-z0-9\.\-_]+/
258 :rev => /[a-z0-9\.\-_]+/
251 }
259 }
252 get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
260 get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
253 :controller => 'repositories',
261 :controller => 'repositories',
254 :action => /(browse|show|entry|raw|changes|annotate|diff)/
262 :action => /(browse|show|entry|raw|changes|annotate|diff)/
255 get 'projects/:id/repository/:action(/*path(.:ext))',
263 get 'projects/:id/repository/:action(/*path(.:ext))',
256 :controller => 'repositories',
264 :controller => 'repositories',
257 :action => /(browse|show|entry|raw|changes|annotate|diff)/
265 :action => /(browse|show|entry|raw|changes|annotate|diff)/
258
266
259 get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
267 get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
260 get 'projects/:id/repository', :to => 'repositories#show', :path => nil
268 get 'projects/:id/repository', :to => 'repositories#show', :path => nil
261
269
262 # additional routes for having the file name at the end of url
270 # additional routes for having the file name at the end of url
263 get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
271 get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
264 get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
272 get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
265 get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
273 get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
266 get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
274 get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
267 resources :attachments, :only => [:show, :destroy]
275 resources :attachments, :only => [:show, :destroy]
268
276
269 resources :groups do
277 resources :groups do
270 member do
278 member do
271 get 'autocomplete_for_user'
279 get 'autocomplete_for_user'
272 end
280 end
273 end
281 end
274
282
275 match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
283 match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
276 match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
284 match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
277 match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
285 match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
278 match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
286 match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
279
287
280 resources :trackers, :except => :show do
288 resources :trackers, :except => :show do
281 collection do
289 collection do
282 match 'fields', :via => [:get, :post]
290 match 'fields', :via => [:get, :post]
283 end
291 end
284 end
292 end
285 resources :issue_statuses, :except => :show do
293 resources :issue_statuses, :except => :show do
286 collection do
294 collection do
287 post 'update_issue_done_ratio'
295 post 'update_issue_done_ratio'
288 end
296 end
289 end
297 end
290 resources :custom_fields, :except => :show
298 resources :custom_fields, :except => :show
291 resources :roles do
299 resources :roles do
292 collection do
300 collection do
293 match 'permissions', :via => [:get, :post]
301 match 'permissions', :via => [:get, :post]
294 end
302 end
295 end
303 end
296 resources :enumerations, :except => :show
304 resources :enumerations, :except => :show
297 match 'enumerations/:type', :to => 'enumerations#index', :via => :get
305 match 'enumerations/:type', :to => 'enumerations#index', :via => :get
298
306
299 get 'projects/:id/search', :controller => 'search', :action => 'index'
307 get 'projects/:id/search', :controller => 'search', :action => 'index'
300 get 'search', :controller => 'search', :action => 'index'
308 get 'search', :controller => 'search', :action => 'index'
301
309
302 match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
310 match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
303
311
304 match 'admin', :controller => 'admin', :action => 'index', :via => :get
312 match 'admin', :controller => 'admin', :action => 'index', :via => :get
305 match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
313 match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
306 match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
314 match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
307 match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
315 match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
308 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
316 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
309 match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
317 match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
310
318
311 resources :auth_sources do
319 resources :auth_sources do
312 member do
320 member do
313 get 'test_connection', :as => 'try_connection'
321 get 'test_connection', :as => 'try_connection'
314 end
322 end
315 collection do
323 collection do
316 get 'autocomplete_for_new_user'
324 get 'autocomplete_for_new_user'
317 end
325 end
318 end
326 end
319
327
320 match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
328 match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
321 match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
329 match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
322 match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
330 match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
323 match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
331 match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
324 match 'settings', :controller => 'settings', :action => 'index', :via => :get
332 match 'settings', :controller => 'settings', :action => 'index', :via => :get
325 match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
333 match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
326 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
334 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
327
335
328 match 'sys/projects', :to => 'sys#projects', :via => :get
336 match 'sys/projects', :to => 'sys#projects', :via => :get
329 match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
337 match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
330 match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
338 match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
331
339
332 match 'uploads', :to => 'attachments#upload', :via => :post
340 match 'uploads', :to => 'attachments#upload', :via => :post
333
341
334 get 'robots.txt', :to => 'welcome#robots'
342 get 'robots.txt', :to => 'welcome#robots'
335
343
336 Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
344 Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
337 file = File.join(plugin_dir, "config/routes.rb")
345 file = File.join(plugin_dir, "config/routes.rb")
338 if File.exists?(file)
346 if File.exists?(file)
339 begin
347 begin
340 instance_eval File.read(file)
348 instance_eval File.read(file)
341 rescue Exception => e
349 rescue Exception => e
342 puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
350 puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
343 exit 1
351 exit 1
344 end
352 end
345 end
353 end
346 end
354 end
347 end
355 end
General Comments 0
You need to be logged in to leave comments. Login now