##// END OF EJS Templates
Use /raw/ for url instead of ?format=raw for getting raw repository files (#1901, #4119)....
Jean-Philippe Lang -
r2960:e24358bc4374
parent child
Show More
@@ -1,268 +1,272
1 ActionController::Routing::Routes.draw do |map|
1 ActionController::Routing::Routes.draw do |map|
2 # Add your own custom routes here.
2 # Add your own custom routes here.
3 # The priority is based upon order of creation: first created -> highest priority.
3 # The priority is based upon order of creation: first created -> highest priority.
4
4
5 # Here's a sample route:
5 # Here's a sample route:
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 # Keep in mind you can assign values other than :controller and :action
7 # Keep in mind you can assign values other than :controller and :action
8
8
9 map.home '', :controller => 'welcome'
9 map.home '', :controller => 'welcome'
10
10
11 map.signin 'login', :controller => 'account', :action => 'login'
11 map.signin 'login', :controller => 'account', :action => 'login'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
13
13
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
16
16
17 map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
17 map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
18 map.connect 'projects/:project_id/time_entries/new', :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'
19 map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
20
20
21 map.with_options :controller => 'timelog' do |timelog|
21 map.with_options :controller => 'timelog' do |timelog|
22 timelog.connect 'projects/:project_id/time_entries', :action => 'details'
22 timelog.connect 'projects/:project_id/time_entries', :action => 'details'
23
23
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
25 time_details.connect 'time_entries'
25 time_details.connect 'time_entries'
26 time_details.connect 'time_entries.:format'
26 time_details.connect 'time_entries.:format'
27 time_details.connect 'issues/:issue_id/time_entries'
27 time_details.connect 'issues/:issue_id/time_entries'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
29 time_details.connect 'projects/:project_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'
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'
31 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
32 end
32 end
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
35 time_report.connect 'time_entries/report'
35 time_report.connect 'time_entries/report'
36 time_report.connect 'time_entries/report.:format'
36 time_report.connect 'time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
38 end
38 end
39
39
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
41 time_edit.connect 'issues/:issue_id/time_entries/new'
41 time_edit.connect 'issues/:issue_id/time_entries/new'
42 end
42 end
43
43
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
45 end
45 end
46
46
47 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
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}
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}
49 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
50 map.with_options :controller => 'wiki' do |wiki_routes|
50 map.with_options :controller => 'wiki' do |wiki_routes|
51 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
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
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
53 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
56 wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
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'
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'
58 wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
59 end
59 end
60
60
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
62 :action => /edit|rename|destroy|preview|protect/,
62 :action => /edit|rename|destroy|preview|protect/,
63 :conditions => {:method => :post}
63 :conditions => {:method => :post}
64 end
64 end
65
65
66 map.with_options :controller => 'messages' do |messages_routes|
66 map.with_options :controller => 'messages' do |messages_routes|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
71 end
71 end
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
74 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
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/
75 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
76 end
76 end
77 end
77 end
78
78
79 map.with_options :controller => 'boards' do |board_routes|
79 map.with_options :controller => 'boards' do |board_routes|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
84 board_views.connect 'projects/:project_id/boards/:id.:format', :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'
85 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
86 end
86 end
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
90 end
90 end
91 end
91 end
92
92
93 map.with_options :controller => 'documents' do |document_routes|
93 map.with_options :controller => 'documents' do |document_routes|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
97 document_views.connect 'documents/:id', :action => 'show'
97 document_views.connect 'documents/:id', :action => 'show'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
99 end
99 end
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
103 end
103 end
104 end
104 end
105
105
106 map.with_options :controller => 'issues' do |issues_routes|
106 map.with_options :controller => 'issues' do |issues_routes|
107 issues_routes.with_options :conditions => {:method => :get} do |issues_views|
107 issues_routes.with_options :conditions => {:method => :get} do |issues_views|
108 issues_views.connect 'issues', :action => 'index'
108 issues_views.connect 'issues', :action => 'index'
109 issues_views.connect 'issues.:format', :action => 'index'
109 issues_views.connect 'issues.:format', :action => 'index'
110 issues_views.connect 'projects/:project_id/issues', :action => 'index'
110 issues_views.connect 'projects/:project_id/issues', :action => 'index'
111 issues_views.connect 'projects/:project_id/issues.:format', :action => 'index'
111 issues_views.connect 'projects/:project_id/issues.:format', :action => 'index'
112 issues_views.connect 'projects/:project_id/issues/new', :action => 'new'
112 issues_views.connect 'projects/:project_id/issues/new', :action => 'new'
113 issues_views.connect 'projects/:project_id/issues/gantt', :action => 'gantt'
113 issues_views.connect 'projects/:project_id/issues/gantt', :action => 'gantt'
114 issues_views.connect 'projects/:project_id/issues/calendar', :action => 'calendar'
114 issues_views.connect 'projects/:project_id/issues/calendar', :action => 'calendar'
115 issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new'
115 issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new'
116 issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/
116 issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/
117 issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/
117 issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/
118 issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/
118 issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/
119 issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/
119 issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/
120 end
120 end
121 issues_routes.with_options :conditions => {:method => :post} do |issues_actions|
121 issues_routes.with_options :conditions => {:method => :post} do |issues_actions|
122 issues_actions.connect 'projects/:project_id/issues', :action => 'new'
122 issues_actions.connect 'projects/:project_id/issues', :action => 'new'
123 issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/
123 issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/
124 issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/
124 issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/
125 end
125 end
126 issues_routes.connect 'issues/:action'
126 issues_routes.connect 'issues/:action'
127 end
127 end
128
128
129 map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
129 map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
130 relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
130 relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
131 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
131 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
132 end
132 end
133
133
134 map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports|
134 map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports|
135 reports.connect 'projects/:id/issues/report'
135 reports.connect 'projects/:id/issues/report'
136 reports.connect 'projects/:id/issues/report/:detail'
136 reports.connect 'projects/:id/issues/report/:detail'
137 end
137 end
138
138
139 map.with_options :controller => 'news' do |news_routes|
139 map.with_options :controller => 'news' do |news_routes|
140 news_routes.with_options :conditions => {:method => :get} do |news_views|
140 news_routes.with_options :conditions => {:method => :get} do |news_views|
141 news_views.connect 'news', :action => 'index'
141 news_views.connect 'news', :action => 'index'
142 news_views.connect 'projects/:project_id/news', :action => 'index'
142 news_views.connect 'projects/:project_id/news', :action => 'index'
143 news_views.connect 'projects/:project_id/news.:format', :action => 'index'
143 news_views.connect 'projects/:project_id/news.:format', :action => 'index'
144 news_views.connect 'news.:format', :action => 'index'
144 news_views.connect 'news.:format', :action => 'index'
145 news_views.connect 'projects/:project_id/news/new', :action => 'new'
145 news_views.connect 'projects/:project_id/news/new', :action => 'new'
146 news_views.connect 'news/:id', :action => 'show'
146 news_views.connect 'news/:id', :action => 'show'
147 news_views.connect 'news/:id/edit', :action => 'edit'
147 news_views.connect 'news/:id/edit', :action => 'edit'
148 end
148 end
149 news_routes.with_options do |news_actions|
149 news_routes.with_options do |news_actions|
150 news_actions.connect 'projects/:project_id/news', :action => 'new'
150 news_actions.connect 'projects/:project_id/news', :action => 'new'
151 news_actions.connect 'news/:id/edit', :action => 'edit'
151 news_actions.connect 'news/:id/edit', :action => 'edit'
152 news_actions.connect 'news/:id/destroy', :action => 'destroy'
152 news_actions.connect 'news/:id/destroy', :action => 'destroy'
153 end
153 end
154 end
154 end
155
155
156 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
156 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
157
157
158 map.with_options :controller => 'users' do |users|
158 map.with_options :controller => 'users' do |users|
159 users.with_options :conditions => {:method => :get} do |user_views|
159 users.with_options :conditions => {:method => :get} do |user_views|
160 user_views.connect 'users', :action => 'index'
160 user_views.connect 'users', :action => 'index'
161 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
161 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
162 user_views.connect 'users/new', :action => 'add'
162 user_views.connect 'users/new', :action => 'add'
163 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
163 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
164 end
164 end
165 users.with_options :conditions => {:method => :post} do |user_actions|
165 users.with_options :conditions => {:method => :post} do |user_actions|
166 user_actions.connect 'users', :action => 'add'
166 user_actions.connect 'users', :action => 'add'
167 user_actions.connect 'users/new', :action => 'add'
167 user_actions.connect 'users/new', :action => 'add'
168 user_actions.connect 'users/:id/edit', :action => 'edit'
168 user_actions.connect 'users/:id/edit', :action => 'edit'
169 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
169 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
170 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
170 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
171 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
171 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
172 end
172 end
173 end
173 end
174
174
175 map.with_options :controller => 'projects' do |projects|
175 map.with_options :controller => 'projects' do |projects|
176 projects.with_options :conditions => {:method => :get} do |project_views|
176 projects.with_options :conditions => {:method => :get} do |project_views|
177 project_views.connect 'projects', :action => 'index'
177 project_views.connect 'projects', :action => 'index'
178 project_views.connect 'projects.:format', :action => 'index'
178 project_views.connect 'projects.:format', :action => 'index'
179 project_views.connect 'projects/new', :action => 'add'
179 project_views.connect 'projects/new', :action => 'add'
180 project_views.connect 'projects/:id', :action => 'show'
180 project_views.connect 'projects/:id', :action => 'show'
181 project_views.connect 'projects/:id/:action', :action => /roadmap|changelog|destroy|settings/
181 project_views.connect 'projects/:id/:action', :action => /roadmap|changelog|destroy|settings/
182 project_views.connect 'projects/:id/files', :action => 'list_files'
182 project_views.connect 'projects/:id/files', :action => 'list_files'
183 project_views.connect 'projects/:id/files/new', :action => 'add_file'
183 project_views.connect 'projects/:id/files/new', :action => 'add_file'
184 project_views.connect 'projects/:id/versions/new', :action => 'add_version'
184 project_views.connect 'projects/:id/versions/new', :action => 'add_version'
185 project_views.connect 'projects/:id/categories/new', :action => 'add_issue_category'
185 project_views.connect 'projects/:id/categories/new', :action => 'add_issue_category'
186 project_views.connect 'projects/:id/settings/:tab', :action => 'settings'
186 project_views.connect 'projects/:id/settings/:tab', :action => 'settings'
187 end
187 end
188
188
189 projects.with_options :action => 'activity', :conditions => {:method => :get} do |activity|
189 projects.with_options :action => 'activity', :conditions => {:method => :get} do |activity|
190 activity.connect 'projects/:id/activity'
190 activity.connect 'projects/:id/activity'
191 activity.connect 'projects/:id/activity.:format'
191 activity.connect 'projects/:id/activity.:format'
192 activity.connect 'activity', :id => nil
192 activity.connect 'activity', :id => nil
193 activity.connect 'activity.:format', :id => nil
193 activity.connect 'activity.:format', :id => nil
194 end
194 end
195
195
196 projects.with_options :conditions => {:method => :post} do |project_actions|
196 projects.with_options :conditions => {:method => :post} do |project_actions|
197 project_actions.connect 'projects/new', :action => 'add'
197 project_actions.connect 'projects/new', :action => 'add'
198 project_actions.connect 'projects', :action => 'add'
198 project_actions.connect 'projects', :action => 'add'
199 project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/
199 project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/
200 project_actions.connect 'projects/:id/files/new', :action => 'add_file'
200 project_actions.connect 'projects/:id/files/new', :action => 'add_file'
201 project_actions.connect 'projects/:id/versions/new', :action => 'add_version'
201 project_actions.connect 'projects/:id/versions/new', :action => 'add_version'
202 project_actions.connect 'projects/:id/categories/new', :action => 'add_issue_category'
202 project_actions.connect 'projects/:id/categories/new', :action => 'add_issue_category'
203 project_actions.connect 'projects/:id/activities/save', :action => 'save_activities'
203 project_actions.connect 'projects/:id/activities/save', :action => 'save_activities'
204 end
204 end
205
205
206 projects.with_options :conditions => {:method => :delete} do |project_actions|
206 projects.with_options :conditions => {:method => :delete} do |project_actions|
207 project_actions.conditions 'projects/:id/reset_activities', :action => 'reset_activities'
207 project_actions.conditions 'projects/:id/reset_activities', :action => 'reset_activities'
208 end
208 end
209 end
209 end
210
210
211 map.with_options :controller => 'versions' do |versions|
211 map.with_options :controller => 'versions' do |versions|
212 versions.with_options :conditions => {:method => :post} do |version_actions|
212 versions.with_options :conditions => {:method => :post} do |version_actions|
213 version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed'
213 version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed'
214 end
214 end
215 end
215 end
216
216
217 map.with_options :controller => 'repositories' do |repositories|
217 map.with_options :controller => 'repositories' do |repositories|
218 repositories.with_options :conditions => {:method => :get} do |repository_views|
218 repositories.with_options :conditions => {:method => :get} do |repository_views|
219 repository_views.connect 'projects/:id/repository', :action => 'show'
219 repository_views.connect 'projects/:id/repository', :action => 'show'
220 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
220 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
221 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
221 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
222 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
222 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
223 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
223 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
224 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
224 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
225 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
225 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
226 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
226 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
227 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
227 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
228 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
229 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
230 # TODO: why the following route is required?
231 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
228 repository_views.connect 'projects/:id/repository/:action/*path'
232 repository_views.connect 'projects/:id/repository/:action/*path'
229 end
233 end
230
234
231 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
235 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
232 end
236 end
233
237
234 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
238 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
235 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
239 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
236 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
240 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
237
241
238 map.resources :groups
242 map.resources :groups
239
243
240 #left old routes at the bottom for backwards compat
244 #left old routes at the bottom for backwards compat
241 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
245 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
242 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
246 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
243 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
247 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
244 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
248 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
245 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
249 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
246 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
250 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
247 map.connect 'projects/:project_id/news/:action', :controller => 'news'
251 map.connect 'projects/:project_id/news/:action', :controller => 'news'
248 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
252 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
249 map.with_options :controller => 'repositories' do |omap|
253 map.with_options :controller => 'repositories' do |omap|
250 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
254 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
251 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
255 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
252 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
256 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
253 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
257 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
254 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
258 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
255 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
259 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
256 end
260 end
257
261
258 map.with_options :controller => 'sys' do |sys|
262 map.with_options :controller => 'sys' do |sys|
259 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
263 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
260 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
264 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
261 end
265 end
262
266
263 # Install the default route as the lowest priority.
267 # Install the default route as the lowest priority.
264 map.connect ':controller/:action/:id'
268 map.connect ':controller/:action/:id'
265 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
269 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
266 # Used for OpenID
270 # Used for OpenID
267 map.root :controller => 'account', :action => 'login'
271 map.root :controller => 'account', :action => 'login'
268 end
272 end
@@ -1,214 +1,228
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 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 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19 require 'repositories_controller'
19 require 'repositories_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class RepositoriesController; def rescue_action(e) raise e end; end
22 class RepositoriesController; def rescue_action(e) raise e end; end
23
23
24 class RepositoriesControllerTest < ActionController::TestCase
24 class RepositoriesControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
26
26
27 def setup
27 def setup
28 @controller = RepositoriesController.new
28 @controller = RepositoriesController.new
29 @request = ActionController::TestRequest.new
29 @request = ActionController::TestRequest.new
30 @response = ActionController::TestResponse.new
30 @response = ActionController::TestResponse.new
31 User.current = nil
31 User.current = nil
32 end
32 end
33
33
34 def test_show_routing
34 def test_show_routing
35 assert_routing(
35 assert_routing(
36 {:method => :get, :path => '/projects/redmine/repository'},
36 {:method => :get, :path => '/projects/redmine/repository'},
37 :controller => 'repositories', :action => 'show', :id => 'redmine'
37 :controller => 'repositories', :action => 'show', :id => 'redmine'
38 )
38 )
39 end
39 end
40
40
41 def test_edit_routing
41 def test_edit_routing
42 assert_routing(
42 assert_routing(
43 {:method => :get, :path => '/projects/world_domination/repository/edit'},
43 {:method => :get, :path => '/projects/world_domination/repository/edit'},
44 :controller => 'repositories', :action => 'edit', :id => 'world_domination'
44 :controller => 'repositories', :action => 'edit', :id => 'world_domination'
45 )
45 )
46 assert_routing(
46 assert_routing(
47 {:method => :post, :path => '/projects/world_domination/repository/edit'},
47 {:method => :post, :path => '/projects/world_domination/repository/edit'},
48 :controller => 'repositories', :action => 'edit', :id => 'world_domination'
48 :controller => 'repositories', :action => 'edit', :id => 'world_domination'
49 )
49 )
50 end
50 end
51
51
52 def test_revisions_routing
52 def test_revisions_routing
53 assert_routing(
53 assert_routing(
54 {:method => :get, :path => '/projects/redmine/repository/revisions'},
54 {:method => :get, :path => '/projects/redmine/repository/revisions'},
55 :controller => 'repositories', :action => 'revisions', :id => 'redmine'
55 :controller => 'repositories', :action => 'revisions', :id => 'redmine'
56 )
56 )
57 end
57 end
58
58
59 def test_revisions_atom_routing
59 def test_revisions_atom_routing
60 assert_routing(
60 assert_routing(
61 {:method => :get, :path => '/projects/redmine/repository/revisions.atom'},
61 {:method => :get, :path => '/projects/redmine/repository/revisions.atom'},
62 :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
62 :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
63 )
63 )
64 end
64 end
65
65
66 def test_revisions
66 def test_revisions
67 get :revisions, :id => 1
67 get :revisions, :id => 1
68 assert_response :success
68 assert_response :success
69 assert_template 'revisions'
69 assert_template 'revisions'
70 assert_not_nil assigns(:changesets)
70 assert_not_nil assigns(:changesets)
71 end
71 end
72
72
73 def test_revision_routing
73 def test_revision_routing
74 assert_routing(
74 assert_routing(
75 {:method => :get, :path => '/projects/restmine/repository/revisions/2457'},
75 {:method => :get, :path => '/projects/restmine/repository/revisions/2457'},
76 :controller => 'repositories', :action => 'revision', :id => 'restmine', :rev => '2457'
76 :controller => 'repositories', :action => 'revision', :id => 'restmine', :rev => '2457'
77 )
77 )
78 end
78 end
79
79
80 def test_revision
80 def test_revision
81 get :revision, :id => 1, :rev => 1
81 get :revision, :id => 1, :rev => 1
82 assert_response :success
82 assert_response :success
83 assert_not_nil assigns(:changeset)
83 assert_not_nil assigns(:changeset)
84 assert_equal "1", assigns(:changeset).revision
84 assert_equal "1", assigns(:changeset).revision
85 end
85 end
86
86
87 def test_revision_with_before_nil_and_afer_normal
87 def test_revision_with_before_nil_and_afer_normal
88 get :revision, {:id => 1, :rev => 1}
88 get :revision, {:id => 1, :rev => 1}
89 assert_response :success
89 assert_response :success
90 assert_template 'revision'
90 assert_template 'revision'
91 assert_no_tag :tag => "div", :attributes => { :class => "contextual" },
91 assert_no_tag :tag => "div", :attributes => { :class => "contextual" },
92 :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/0'}
92 :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/0'}
93 }
93 }
94 assert_tag :tag => "div", :attributes => { :class => "contextual" },
94 assert_tag :tag => "div", :attributes => { :class => "contextual" },
95 :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/2'}
95 :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/2'}
96 }
96 }
97 end
97 end
98
98
99 def test_diff_routing
99 def test_diff_routing
100 assert_routing(
100 assert_routing(
101 {:method => :get, :path => '/projects/restmine/repository/revisions/2457/diff'},
101 {:method => :get, :path => '/projects/restmine/repository/revisions/2457/diff'},
102 :controller => 'repositories', :action => 'diff', :id => 'restmine', :rev => '2457'
102 :controller => 'repositories', :action => 'diff', :id => 'restmine', :rev => '2457'
103 )
103 )
104 end
104 end
105
105
106 def test_unified_diff_routing
106 def test_unified_diff_routing
107 assert_routing(
107 assert_routing(
108 {:method => :get, :path => '/projects/restmine/repository/revisions/2457/diff.diff'},
108 {:method => :get, :path => '/projects/restmine/repository/revisions/2457/diff.diff'},
109 :controller => 'repositories', :action => 'diff', :id => 'restmine', :rev => '2457', :format => 'diff'
109 :controller => 'repositories', :action => 'diff', :id => 'restmine', :rev => '2457', :format => 'diff'
110 )
110 )
111 end
111 end
112
112
113 def test_diff_path_routing
113 def test_diff_path_routing
114 assert_routing(
114 assert_routing(
115 {:method => :get, :path => '/projects/restmine/repository/diff/path/to/file.c'},
115 {:method => :get, :path => '/projects/restmine/repository/diff/path/to/file.c'},
116 :controller => 'repositories', :action => 'diff', :id => 'restmine', :path => %w[path to file.c]
116 :controller => 'repositories', :action => 'diff', :id => 'restmine', :path => %w[path to file.c]
117 )
117 )
118 end
118 end
119
119
120 def test_diff_path_routing_with_revision
120 def test_diff_path_routing_with_revision
121 assert_routing(
121 assert_routing(
122 {:method => :get, :path => '/projects/restmine/repository/revisions/2/diff/path/to/file.c'},
122 {:method => :get, :path => '/projects/restmine/repository/revisions/2/diff/path/to/file.c'},
123 :controller => 'repositories', :action => 'diff', :id => 'restmine', :path => %w[path to file.c], :rev => '2'
123 :controller => 'repositories', :action => 'diff', :id => 'restmine', :path => %w[path to file.c], :rev => '2'
124 )
124 )
125 end
125 end
126
126
127 def test_browse_routing
127 def test_browse_routing
128 assert_routing(
128 assert_routing(
129 {:method => :get, :path => '/projects/restmine/repository/browse/path/to/dir'},
129 {:method => :get, :path => '/projects/restmine/repository/browse/path/to/dir'},
130 :controller => 'repositories', :action => 'browse', :id => 'restmine', :path => %w[path to dir]
130 :controller => 'repositories', :action => 'browse', :id => 'restmine', :path => %w[path to dir]
131 )
131 )
132 end
132 end
133
133
134 def test_entry_routing
134 def test_entry_routing
135 assert_routing(
135 assert_routing(
136 {:method => :get, :path => '/projects/restmine/repository/entry/path/to/file.c'},
136 {:method => :get, :path => '/projects/restmine/repository/entry/path/to/file.c'},
137 :controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c]
137 :controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c]
138 )
138 )
139 end
139 end
140
140
141 def test_entry_routing_with_revision
141 def test_entry_routing_with_revision
142 assert_routing(
142 assert_routing(
143 {:method => :get, :path => '/projects/restmine/repository/revisions/2/entry/path/to/file.c'},
143 {:method => :get, :path => '/projects/restmine/repository/revisions/2/entry/path/to/file.c'},
144 :controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :rev => '2'
144 :controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :rev => '2'
145 )
145 )
146 end
146 end
147
148 def test_raw_routing
149 assert_routing(
150 {:method => :get, :path => '/projects/restmine/repository/raw/path/to/file.c'},
151 :controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :format => 'raw'
152 )
153 end
154
155 def test_raw_routing_with_revision
156 assert_routing(
157 {:method => :get, :path => '/projects/restmine/repository/revisions/2/raw/path/to/file.c'},
158 :controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :format => 'raw', :rev => '2'
159 )
160 end
147
161
148 def test_annotate_routing
162 def test_annotate_routing
149 assert_routing(
163 assert_routing(
150 {:method => :get, :path => '/projects/restmine/repository/annotate/path/to/file.c'},
164 {:method => :get, :path => '/projects/restmine/repository/annotate/path/to/file.c'},
151 :controller => 'repositories', :action => 'annotate', :id => 'restmine', :path => %w[path to file.c]
165 :controller => 'repositories', :action => 'annotate', :id => 'restmine', :path => %w[path to file.c]
152 )
166 )
153 end
167 end
154
168
155 def test_changesrouting
169 def test_changesrouting
156 assert_routing(
170 assert_routing(
157 {:method => :get, :path => '/projects/restmine/repository/changes/path/to/file.c'},
171 {:method => :get, :path => '/projects/restmine/repository/changes/path/to/file.c'},
158 :controller => 'repositories', :action => 'changes', :id => 'restmine', :path => %w[path to file.c]
172 :controller => 'repositories', :action => 'changes', :id => 'restmine', :path => %w[path to file.c]
159 )
173 )
160 end
174 end
161
175
162 def test_statistics_routing
176 def test_statistics_routing
163 assert_routing(
177 assert_routing(
164 {:method => :get, :path => '/projects/restmine/repository/statistics'},
178 {:method => :get, :path => '/projects/restmine/repository/statistics'},
165 :controller => 'repositories', :action => 'stats', :id => 'restmine'
179 :controller => 'repositories', :action => 'stats', :id => 'restmine'
166 )
180 )
167 end
181 end
168
182
169 def test_graph_commits_per_month
183 def test_graph_commits_per_month
170 get :graph, :id => 1, :graph => 'commits_per_month'
184 get :graph, :id => 1, :graph => 'commits_per_month'
171 assert_response :success
185 assert_response :success
172 assert_equal 'image/svg+xml', @response.content_type
186 assert_equal 'image/svg+xml', @response.content_type
173 end
187 end
174
188
175 def test_graph_commits_per_author
189 def test_graph_commits_per_author
176 get :graph, :id => 1, :graph => 'commits_per_author'
190 get :graph, :id => 1, :graph => 'commits_per_author'
177 assert_response :success
191 assert_response :success
178 assert_equal 'image/svg+xml', @response.content_type
192 assert_equal 'image/svg+xml', @response.content_type
179 end
193 end
180
194
181 def test_committers
195 def test_committers
182 @request.session[:user_id] = 2
196 @request.session[:user_id] = 2
183 # add a commit with an unknown user
197 # add a commit with an unknown user
184 Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
198 Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
185
199
186 get :committers, :id => 1
200 get :committers, :id => 1
187 assert_response :success
201 assert_response :success
188 assert_template 'committers'
202 assert_template 'committers'
189
203
190 assert_tag :td, :content => 'dlopper',
204 assert_tag :td, :content => 'dlopper',
191 :sibling => { :tag => 'td',
205 :sibling => { :tag => 'td',
192 :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} },
206 :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} },
193 :child => { :tag => 'option', :content => 'Dave Lopper',
207 :child => { :tag => 'option', :content => 'Dave Lopper',
194 :attributes => { :value => '3', :selected => 'selected' }}}}
208 :attributes => { :value => '3', :selected => 'selected' }}}}
195 assert_tag :td, :content => 'foo',
209 assert_tag :td, :content => 'foo',
196 :sibling => { :tag => 'td',
210 :sibling => { :tag => 'td',
197 :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} }}}
211 :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} }}}
198 assert_no_tag :td, :content => 'foo',
212 assert_no_tag :td, :content => 'foo',
199 :sibling => { :tag => 'td',
213 :sibling => { :tag => 'td',
200 :descendant => { :tag => 'option', :attributes => { :selected => 'selected' }}}
214 :descendant => { :tag => 'option', :attributes => { :selected => 'selected' }}}
201 end
215 end
202
216
203 def test_map_committers
217 def test_map_committers
204 @request.session[:user_id] = 2
218 @request.session[:user_id] = 2
205 # add a commit with an unknown user
219 # add a commit with an unknown user
206 c = Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
220 c = Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
207
221
208 assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
222 assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
209 post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
223 post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
210 assert_redirected_to 'projects/ecookbook/repository/committers'
224 assert_redirected_to 'projects/ecookbook/repository/committers'
211 assert_equal User.find(2), c.reload.user
225 assert_equal User.find(2), c.reload.user
212 end
226 end
213 end
227 end
214 end
228 end
General Comments 0
You need to be logged in to leave comments. Login now