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