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