1
|
ActionController::Routing::Routes.draw do |map|
|
2
|
# Add your own custom routes here.
|
3
|
# The priority is based upon order of creation: first created -> highest priority.
|
4
|
|
5
|
# Here's a sample route:
|
6
|
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
7
|
# Keep in mind you can assign values other than :controller and :action
|
8
|
|
9
|
map.home '', :controller => 'welcome'
|
10
|
|
11
|
map.signin 'login', :controller => 'account', :action => 'login'
|
12
|
map.signout 'logout', :controller => 'account', :action => 'logout'
|
13
|
|
14
|
map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
|
15
|
map.connect 'help/:ctrl/:page', :controller => 'help'
|
16
|
|
17
|
map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
|
18
|
map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
|
19
|
map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
|
20
|
|
21
|
map.with_options :controller => 'timelog' do |timelog|
|
22
|
timelog.connect 'projects/:project_id/time_entries', :action => 'details'
|
23
|
|
24
|
timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
|
25
|
time_details.connect 'time_entries'
|
26
|
time_details.connect 'time_entries.:format'
|
27
|
time_details.connect 'issues/:issue_id/time_entries'
|
28
|
time_details.connect 'issues/:issue_id/time_entries.:format'
|
29
|
time_details.connect 'projects/:project_id/time_entries.:format'
|
30
|
time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
|
31
|
time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
|
32
|
end
|
33
|
timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
|
34
|
timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
|
35
|
time_report.connect 'time_entries/report'
|
36
|
time_report.connect 'time_entries/report.:format'
|
37
|
time_report.connect 'projects/:project_id/time_entries/report.:format'
|
38
|
end
|
39
|
|
40
|
timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
|
41
|
time_edit.connect 'issues/:issue_id/time_entries/new'
|
42
|
end
|
43
|
|
44
|
timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
|
45
|
end
|
46
|
|
47
|
map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
|
48
|
map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
|
49
|
map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
|
50
|
map.with_options :controller => 'wiki' do |wiki_routes|
|
51
|
wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
|
52
|
wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
|
53
|
wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
|
54
|
wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
|
55
|
wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
|
56
|
wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
|
57
|
wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
|
58
|
wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
|
59
|
end
|
60
|
|
61
|
wiki_routes.connect 'projects/:id/wiki/:page/:action',
|
62
|
:action => /edit|rename|destroy|preview|protect/,
|
63
|
:conditions => {:method => :post}
|
64
|
end
|
65
|
|
66
|
map.with_options :controller => 'messages' do |messages_routes|
|
67
|
messages_routes.with_options :conditions => {:method => :get} do |messages_views|
|
68
|
messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
|
69
|
messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
|
70
|
messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
|
71
|
end
|
72
|
messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
|
73
|
messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
|
74
|
messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
|
75
|
messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
|
76
|
end
|
77
|
end
|
78
|
|
79
|
map.with_options :controller => 'boards' do |board_routes|
|
80
|
board_routes.with_options :conditions => {:method => :get} do |board_views|
|
81
|
board_views.connect 'projects/:project_id/boards', :action => 'index'
|
82
|
board_views.connect 'projects/:project_id/boards/new', :action => 'new'
|
83
|
board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
|
84
|
board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
|
85
|
board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
|
86
|
end
|
87
|
board_routes.with_options :conditions => {:method => :post} do |board_actions|
|
88
|
board_actions.connect 'projects/:project_id/boards', :action => 'new'
|
89
|
board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
|
90
|
end
|
91
|
end
|
92
|
|
93
|
map.with_options :controller => 'documents' do |document_routes|
|
94
|
document_routes.with_options :conditions => {:method => :get} do |document_views|
|
95
|
document_views.connect 'projects/:project_id/documents', :action => 'index'
|
96
|
document_views.connect 'projects/:project_id/documents/new', :action => 'new'
|
97
|
document_views.connect 'documents/:id', :action => 'show'
|
98
|
document_views.connect 'documents/:id/edit', :action => 'edit'
|
99
|
end
|
100
|
document_routes.with_options :conditions => {:method => :post} do |document_actions|
|
101
|
document_actions.connect 'projects/:project_id/documents', :action => 'new'
|
102
|
document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
|
103
|
end
|
104
|
end
|
105
|
|
106
|
map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
|
107
|
|
108
|
# Misc issue routes. TODO: move into resources
|
109
|
map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
|
110
|
map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
|
111
|
map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
|
112
|
map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
|
113
|
map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
|
114
|
map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
|
115
|
map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
|
116
|
map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
|
117
|
|
118
|
map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
|
119
|
map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
|
120
|
map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
|
121
|
map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update]
|
122
|
|
123
|
map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
|
124
|
reports.connect 'projects/:id/issues/report', :action => 'issue_report'
|
125
|
reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
|
126
|
end
|
127
|
|
128
|
# Following two routes conflict with the resources because #index allows POST
|
129
|
map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
|
130
|
map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
|
131
|
|
132
|
map.resources :issues, :member => { :edit => :post }, :collection => {}
|
133
|
map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post }
|
134
|
|
135
|
map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
|
136
|
relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
|
137
|
relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
|
138
|
end
|
139
|
|
140
|
map.with_options :controller => 'news' do |news_routes|
|
141
|
news_routes.with_options :conditions => {:method => :get} do |news_views|
|
142
|
news_views.connect 'news', :action => 'index'
|
143
|
news_views.connect 'projects/:project_id/news', :action => 'index'
|
144
|
news_views.connect 'projects/:project_id/news.:format', :action => 'index'
|
145
|
news_views.connect 'news.:format', :action => 'index'
|
146
|
news_views.connect 'projects/:project_id/news/new', :action => 'new'
|
147
|
news_views.connect 'news/:id', :action => 'show'
|
148
|
news_views.connect 'news/:id/edit', :action => 'edit'
|
149
|
end
|
150
|
news_routes.with_options do |news_actions|
|
151
|
news_actions.connect 'projects/:project_id/news', :action => 'new'
|
152
|
news_actions.connect 'news/:id/edit', :action => 'edit'
|
153
|
news_actions.connect 'news/:id/destroy', :action => 'destroy'
|
154
|
end
|
155
|
end
|
156
|
|
157
|
map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
|
158
|
|
159
|
map.with_options :controller => 'users' do |users|
|
160
|
users.with_options :conditions => {:method => :get} do |user_views|
|
161
|
user_views.connect 'users', :action => 'index'
|
162
|
user_views.connect 'users/:id', :action => 'show', :id => /\d+/
|
163
|
user_views.connect 'users/new', :action => 'add'
|
164
|
user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
|
165
|
end
|
166
|
users.with_options :conditions => {:method => :post} do |user_actions|
|
167
|
user_actions.connect 'users', :action => 'add'
|
168
|
user_actions.connect 'users/new', :action => 'add'
|
169
|
user_actions.connect 'users/:id/edit', :action => 'edit'
|
170
|
user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
|
171
|
user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
|
172
|
user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
|
173
|
end
|
174
|
end
|
175
|
|
176
|
map.with_options :controller => 'projects' do |projects|
|
177
|
projects.with_options :conditions => {:method => :get} do |project_views|
|
178
|
project_views.connect 'projects', :action => 'index'
|
179
|
project_views.connect 'projects.:format', :action => 'index'
|
180
|
project_views.connect 'projects/new', :action => 'add'
|
181
|
project_views.connect 'projects/:id', :action => 'show'
|
182
|
project_views.connect 'projects/:id.:format', :action => 'show'
|
183
|
project_views.connect 'projects/:id/:action', :action => /destroy|settings/
|
184
|
project_views.connect 'projects/:id/files', :controller => 'files', :action => 'index'
|
185
|
project_views.connect 'projects/:id/files/new', :controller => 'files', :action => 'new'
|
186
|
project_views.connect 'projects/:id/settings/:tab', :action => 'settings'
|
187
|
project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
|
188
|
end
|
189
|
|
190
|
projects.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
|
191
|
activity.connect 'projects/:id/activity'
|
192
|
activity.connect 'projects/:id/activity.:format'
|
193
|
activity.connect 'activity', :id => nil
|
194
|
activity.connect 'activity.:format', :id => nil
|
195
|
end
|
196
|
|
197
|
projects.with_options :conditions => {:method => :post} do |project_actions|
|
198
|
project_actions.connect 'projects/new', :action => 'create'
|
199
|
project_actions.connect 'projects', :action => 'create'
|
200
|
project_actions.connect 'projects.:format', :action => 'create', :format => /xml/
|
201
|
project_actions.connect 'projects/:id/:action', :action => /edit|destroy|archive|unarchive/
|
202
|
project_actions.connect 'projects/:id/files/new', :controller => 'files', :action => 'new'
|
203
|
project_actions.connect 'projects/:id/activities/save', :controller => 'project_enumerations', :action => 'save'
|
204
|
end
|
205
|
|
206
|
projects.with_options :conditions => {:method => :put} do |project_actions|
|
207
|
project_actions.conditions 'projects/:id.:format', :action => 'edit', :format => /xml/
|
208
|
end
|
209
|
|
210
|
projects.with_options :conditions => {:method => :delete} do |project_actions|
|
211
|
project_actions.conditions 'projects/:id.:format', :action => 'destroy', :format => /xml/
|
212
|
project_actions.conditions 'projects/:id/reset_activities', :controller => 'project_enumerations', :action => 'destroy'
|
213
|
end
|
214
|
end
|
215
|
|
216
|
map.with_options :controller => 'versions' do |versions|
|
217
|
versions.connect 'projects/:project_id/versions/new', :action => 'new'
|
218
|
versions.connect 'projects/:project_id/roadmap', :action => 'index'
|
219
|
versions.with_options :conditions => {:method => :post} do |version_actions|
|
220
|
version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed'
|
221
|
end
|
222
|
end
|
223
|
|
224
|
map.with_options :controller => 'issue_categories' do |categories|
|
225
|
categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
|
226
|
end
|
227
|
|
228
|
map.with_options :controller => 'repositories' do |repositories|
|
229
|
repositories.with_options :conditions => {:method => :get} do |repository_views|
|
230
|
repository_views.connect 'projects/:id/repository', :action => 'show'
|
231
|
repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
|
232
|
repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
|
233
|
repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
|
234
|
repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
|
235
|
repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
|
236
|
repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
|
237
|
repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
|
238
|
repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
|
239
|
repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
|
240
|
repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
|
241
|
# TODO: why the following route is required?
|
242
|
repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
|
243
|
repository_views.connect 'projects/:id/repository/:action/*path'
|
244
|
end
|
245
|
|
246
|
repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
|
247
|
end
|
248
|
|
249
|
map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
|
250
|
map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
|
251
|
map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
|
252
|
|
253
|
map.resources :groups
|
254
|
|
255
|
#left old routes at the bottom for backwards compat
|
256
|
map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
|
257
|
map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
|
258
|
map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
|
259
|
map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
|
260
|
map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
|
261
|
map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
|
262
|
map.connect 'projects/:project_id/news/:action', :controller => 'news'
|
263
|
map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
|
264
|
map.with_options :controller => 'repositories' do |omap|
|
265
|
omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
|
266
|
omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
|
267
|
omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
|
268
|
omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
|
269
|
omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
|
270
|
omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
|
271
|
end
|
272
|
|
273
|
map.with_options :controller => 'sys' do |sys|
|
274
|
sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
|
275
|
sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
|
276
|
end
|
277
|
|
278
|
# Install the default route as the lowest priority.
|
279
|
map.connect ':controller/:action/:id'
|
280
|
map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
|
281
|
# Used for OpenID
|
282
|
map.root :controller => 'account', :action => 'login'
|
283
|
end
|