##// END OF EJS Templates
Removed obsolete routes....
Jean-Philippe Lang -
r7897:526736dedced
parent child
Show More
@@ -1,245 +1,241
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.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report|
17 map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report|
18 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report'
18 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report'
19 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format'
19 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format'
20 time_report.connect 'projects/:project_id/time_entries/report'
20 time_report.connect 'projects/:project_id/time_entries/report'
21 time_report.connect 'projects/:project_id/time_entries/report.:format'
21 time_report.connect 'projects/:project_id/time_entries/report.:format'
22 time_report.connect 'time_entries/report'
22 time_report.connect 'time_entries/report'
23 time_report.connect 'time_entries/report.:format'
23 time_report.connect 'time_entries/report.:format'
24 end
24 end
25
25
26 map.bulk_edit_time_entry 'time_entries/bulk_edit',
26 map.bulk_edit_time_entry 'time_entries/bulk_edit',
27 :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get }
27 :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get }
28 map.bulk_update_time_entry 'time_entries/bulk_edit',
28 map.bulk_update_time_entry 'time_entries/bulk_edit',
29 :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post }
29 :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post }
30 map.time_entries_context_menu '/time_entries/context_menu',
30 map.time_entries_context_menu '/time_entries/context_menu',
31 :controller => 'context_menus', :action => 'time_entries'
31 :controller => 'context_menus', :action => 'time_entries'
32 # TODO: wasteful since this is also nested under issues, projects, and projects/issues
32 # TODO: wasteful since this is also nested under issues, projects, and projects/issues
33 map.resources :time_entries, :controller => 'timelog'
33 map.resources :time_entries, :controller => 'timelog'
34
34
35 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
35 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
36 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
36 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
37 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
37 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
38
38
39 map.with_options :controller => 'messages' do |messages_routes|
39 map.with_options :controller => 'messages' do |messages_routes|
40 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
40 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
41 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
41 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
42 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
42 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
43 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
43 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
44 end
44 end
45 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
45 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
46 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
46 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
47 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
47 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
48 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
48 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
49 end
49 end
50 end
50 end
51
51
52 map.with_options :controller => 'boards' do |board_routes|
52 map.with_options :controller => 'boards' do |board_routes|
53 board_routes.with_options :conditions => {:method => :get} do |board_views|
53 board_routes.with_options :conditions => {:method => :get} do |board_views|
54 board_views.connect 'projects/:project_id/boards', :action => 'index'
54 board_views.connect 'projects/:project_id/boards', :action => 'index'
55 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
55 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
56 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
56 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
57 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
57 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
58 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
58 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
59 end
59 end
60 board_routes.with_options :conditions => {:method => :post} do |board_actions|
60 board_routes.with_options :conditions => {:method => :post} do |board_actions|
61 board_actions.connect 'projects/:project_id/boards', :action => 'new'
61 board_actions.connect 'projects/:project_id/boards', :action => 'new'
62 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
62 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
63 end
63 end
64 end
64 end
65
65
66 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
66 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
67 map.resources :queries, :except => [:show]
67 map.resources :queries, :except => [:show]
68
68
69 # Misc issue routes. TODO: move into resources
69 # Misc issue routes. TODO: move into resources
70 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
70 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
71 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
71 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
72 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
72 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
73 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
73 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
74 map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
74 map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
75 map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
75 map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
76 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
76 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
77 map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
77 map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
78
78
79 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
79 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
80 gantts_routes.connect '/projects/:project_id/issues/gantt'
80 gantts_routes.connect '/projects/:project_id/issues/gantt'
81 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
81 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
82 gantts_routes.connect '/issues/gantt.:format'
82 gantts_routes.connect '/issues/gantt.:format'
83 end
83 end
84
84
85 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
85 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
86 calendars_routes.connect '/projects/:project_id/issues/calendar'
86 calendars_routes.connect '/projects/:project_id/issues/calendar'
87 calendars_routes.connect '/issues/calendar'
87 calendars_routes.connect '/issues/calendar'
88 end
88 end
89
89
90 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
90 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
91 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
91 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
92 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
92 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
93 end
93 end
94
94
95 # Following two routes conflict with the resources because #index allows POST
96 map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
97 map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
98
99 map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
95 map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
100 issues.resources :time_entries, :controller => 'timelog'
96 issues.resources :time_entries, :controller => 'timelog'
101 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
97 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
102 end
98 end
103
99
104 map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
100 map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
105 issues.resources :time_entries, :controller => 'timelog'
101 issues.resources :time_entries, :controller => 'timelog'
106 end
102 end
107
103
108 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
104 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
109
105
110 map.with_options :controller => 'users' do |users|
106 map.with_options :controller => 'users' do |users|
111 users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get}
107 users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get}
112
108
113 users.with_options :conditions => {:method => :post} do |user_actions|
109 users.with_options :conditions => {:method => :post} do |user_actions|
114 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
110 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
115 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
111 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
116 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
112 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
117 end
113 end
118 end
114 end
119
115
120 map.resources :users, :member => {
116 map.resources :users, :member => {
121 :edit_membership => :post,
117 :edit_membership => :post,
122 :destroy_membership => :post
118 :destroy_membership => :post
123 }
119 }
124
120
125 # For nice "roadmap" in the url for the index action
121 # For nice "roadmap" in the url for the index action
126 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
122 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
127
123
128 map.all_news 'news', :controller => 'news', :action => 'index'
124 map.all_news 'news', :controller => 'news', :action => 'index'
129 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
125 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
130 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
126 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
131 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
127 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
132 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
128 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
133
129
134 map.resources :projects, :member => {
130 map.resources :projects, :member => {
135 :copy => [:get, :post],
131 :copy => [:get, :post],
136 :settings => :get,
132 :settings => :get,
137 :modules => :post,
133 :modules => :post,
138 :archive => :post,
134 :archive => :post,
139 :unarchive => :post
135 :unarchive => :post
140 } do |project|
136 } do |project|
141 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
137 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
142 project.resources :files, :only => [:index, :new, :create]
138 project.resources :files, :only => [:index, :new, :create]
143 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
139 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
144 project.resources :news, :shallow => true
140 project.resources :news, :shallow => true
145 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
141 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
146 project.resources :queries, :only => [:new, :create]
142 project.resources :queries, :only => [:new, :create]
147 project.resources :issue_categories, :shallow => true
143 project.resources :issue_categories, :shallow => true
148 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
144 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
149
145
150 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
146 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
151 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
147 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
152 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
148 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
153 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
149 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
154 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
150 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
155 project.resources :wiki, :except => [:new, :create], :member => {
151 project.resources :wiki, :except => [:new, :create], :member => {
156 :rename => [:get, :post],
152 :rename => [:get, :post],
157 :history => :get,
153 :history => :get,
158 :preview => :any,
154 :preview => :any,
159 :protect => :post,
155 :protect => :post,
160 :add_attachment => :post
156 :add_attachment => :post
161 }, :collection => {
157 }, :collection => {
162 :export => :get,
158 :export => :get,
163 :date_index => :get
159 :date_index => :get
164 }
160 }
165
161
166 end
162 end
167
163
168 # Destroy uses a get request to prompt the user before the actual DELETE request
164 # Destroy uses a get request to prompt the user before the actual DELETE request
169 map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
165 map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
170
166
171 # TODO: port to be part of the resources route(s)
167 # TODO: port to be part of the resources route(s)
172 map.with_options :controller => 'projects' do |project_mapper|
168 map.with_options :controller => 'projects' do |project_mapper|
173 project_mapper.with_options :conditions => {:method => :get} do |project_views|
169 project_mapper.with_options :conditions => {:method => :get} do |project_views|
174 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
170 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
175 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
171 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
176 end
172 end
177 end
173 end
178
174
179 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
175 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
180 activity.connect 'projects/:id/activity'
176 activity.connect 'projects/:id/activity'
181 activity.connect 'projects/:id/activity.:format'
177 activity.connect 'projects/:id/activity.:format'
182 activity.connect 'activity', :id => nil
178 activity.connect 'activity', :id => nil
183 activity.connect 'activity.:format', :id => nil
179 activity.connect 'activity.:format', :id => nil
184 end
180 end
185
181
186 map.with_options :controller => 'repositories' do |repositories|
182 map.with_options :controller => 'repositories' do |repositories|
187 repositories.with_options :conditions => {:method => :get} do |repository_views|
183 repositories.with_options :conditions => {:method => :get} do |repository_views|
188 repository_views.connect 'projects/:id/repository', :action => 'show'
184 repository_views.connect 'projects/:id/repository', :action => 'show'
189 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
185 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
190 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
186 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
191 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
187 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
192 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
188 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
193 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
189 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
194 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
190 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
195 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
191 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
196 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
192 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
197 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
193 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
198 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
194 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
199 # TODO: why the following route is required?
195 # TODO: why the following route is required?
200 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
196 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
201 repository_views.connect 'projects/:id/repository/:action/*path'
197 repository_views.connect 'projects/:id/repository/:action/*path'
202 end
198 end
203
199
204 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
200 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
205 end
201 end
206
202
207 map.resources :attachments, :only => [:show, :destroy]
203 map.resources :attachments, :only => [:show, :destroy]
208 # additional routes for having the file name at the end of url
204 # additional routes for having the file name at the end of url
209 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
205 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
210 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
206 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
211
207
212 map.resources :groups, :member => {:autocomplete_for_user => :get}
208 map.resources :groups, :member => {:autocomplete_for_user => :get}
213 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
209 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
214 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
210 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
215
211
216 map.resources :trackers, :except => :show
212 map.resources :trackers, :except => :show
217 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
213 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
218
214
219 #left old routes at the bottom for backwards compat
215 #left old routes at the bottom for backwards compat
220 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
216 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
221 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
217 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
222 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
218 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
223 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
219 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
224 map.connect 'projects/:project_id/news/:action', :controller => 'news'
220 map.connect 'projects/:project_id/news/:action', :controller => 'news'
225 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
221 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
226 map.with_options :controller => 'repositories' do |omap|
222 map.with_options :controller => 'repositories' do |omap|
227 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
223 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
228 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
224 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
229 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
225 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
230 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
226 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
231 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
227 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
232 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
228 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
233 end
229 end
234
230
235 map.with_options :controller => 'sys' do |sys|
231 map.with_options :controller => 'sys' do |sys|
236 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
232 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
237 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
233 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
238 end
234 end
239
235
240 # Install the default route as the lowest priority.
236 # Install the default route as the lowest priority.
241 map.connect ':controller/:action/:id'
237 map.connect ':controller/:action/:id'
242 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
238 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
243 # Used for OpenID
239 # Used for OpenID
244 map.root :controller => 'account', :action => 'login'
240 map.root :controller => 'account', :action => 'login'
245 end
241 end
@@ -1,200 +1,200
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class IssuesTest < ActionController::IntegrationTest
20 class IssuesTest < ActionController::IntegrationTest
21 fixtures :projects,
21 fixtures :projects,
22 :users,
22 :users,
23 :roles,
23 :roles,
24 :members,
24 :members,
25 :trackers,
25 :trackers,
26 :projects_trackers,
26 :projects_trackers,
27 :enabled_modules,
27 :enabled_modules,
28 :issue_statuses,
28 :issue_statuses,
29 :issues,
29 :issues,
30 :enumerations,
30 :enumerations,
31 :custom_fields,
31 :custom_fields,
32 :custom_values,
32 :custom_values,
33 :custom_fields_trackers
33 :custom_fields_trackers
34
34
35 # create an issue
35 # create an issue
36 def test_add_issue
36 def test_add_issue
37 log_user('jsmith', 'jsmith')
37 log_user('jsmith', 'jsmith')
38 get 'projects/1/issues/new', :tracker_id => '1'
38 get 'projects/1/issues/new', :tracker_id => '1'
39 assert_response :success
39 assert_response :success
40 assert_template 'issues/new'
40 assert_template 'issues/new'
41
41
42 post 'projects/1/issues', :tracker_id => "1",
42 post 'projects/1/issues', :tracker_id => "1",
43 :issue => { :start_date => "2006-12-26",
43 :issue => { :start_date => "2006-12-26",
44 :priority_id => "4",
44 :priority_id => "4",
45 :subject => "new test issue",
45 :subject => "new test issue",
46 :category_id => "",
46 :category_id => "",
47 :description => "new issue",
47 :description => "new issue",
48 :done_ratio => "0",
48 :done_ratio => "0",
49 :due_date => "",
49 :due_date => "",
50 :assigned_to_id => "" },
50 :assigned_to_id => "" },
51 :custom_fields => {'2' => 'Value for field 2'}
51 :custom_fields => {'2' => 'Value for field 2'}
52 # find created issue
52 # find created issue
53 issue = Issue.find_by_subject("new test issue")
53 issue = Issue.find_by_subject("new test issue")
54 assert_kind_of Issue, issue
54 assert_kind_of Issue, issue
55
55
56 # check redirection
56 # check redirection
57 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
57 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
58 follow_redirect!
58 follow_redirect!
59 assert_equal issue, assigns(:issue)
59 assert_equal issue, assigns(:issue)
60
60
61 # check issue attributes
61 # check issue attributes
62 assert_equal 'jsmith', issue.author.login
62 assert_equal 'jsmith', issue.author.login
63 assert_equal 1, issue.project.id
63 assert_equal 1, issue.project.id
64 assert_equal 1, issue.status.id
64 assert_equal 1, issue.status.id
65 end
65 end
66
66
67 # add then remove 2 attachments to an issue
67 # add then remove 2 attachments to an issue
68 def test_issue_attachments
68 def test_issue_attachments
69 log_user('jsmith', 'jsmith')
69 log_user('jsmith', 'jsmith')
70 set_tmp_attachments_directory
70 set_tmp_attachments_directory
71
71
72 put 'issues/1',
72 put 'issues/1',
73 :notes => 'Some notes',
73 :notes => 'Some notes',
74 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
74 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
75 assert_redirected_to "/issues/1"
75 assert_redirected_to "/issues/1"
76
76
77 # make sure attachment was saved
77 # make sure attachment was saved
78 attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
78 attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
79 assert_kind_of Attachment, attachment
79 assert_kind_of Attachment, attachment
80 assert_equal Issue.find(1), attachment.container
80 assert_equal Issue.find(1), attachment.container
81 assert_equal 'This is an attachment', attachment.description
81 assert_equal 'This is an attachment', attachment.description
82 # verify the size of the attachment stored in db
82 # verify the size of the attachment stored in db
83 #assert_equal file_data_1.length, attachment.filesize
83 #assert_equal file_data_1.length, attachment.filesize
84 # verify that the attachment was written to disk
84 # verify that the attachment was written to disk
85 assert File.exist?(attachment.diskfile)
85 assert File.exist?(attachment.diskfile)
86
86
87 # remove the attachments
87 # remove the attachments
88 Issue.find(1).attachments.each(&:destroy)
88 Issue.find(1).attachments.each(&:destroy)
89 assert_equal 0, Issue.find(1).attachments.length
89 assert_equal 0, Issue.find(1).attachments.length
90 end
90 end
91
91
92 def test_other_formats_links_on_get_index
92 def test_other_formats_links_on_index
93 get '/projects/ecookbook/issues'
93 get '/projects/ecookbook/issues'
94
94
95 %w(Atom PDF CSV).each do |format|
95 %w(Atom PDF CSV).each do |format|
96 assert_tag :a, :content => format,
96 assert_tag :a, :content => format,
97 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
97 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
98 :rel => 'nofollow' }
98 :rel => 'nofollow' }
99 end
99 end
100 end
100 end
101
101
102 def test_other_formats_links_on_post_index_without_project_id_in_url
102 def test_other_formats_links_on_index_without_project_id_in_url
103 post '/issues', :project_id => 'ecookbook'
103 get '/issues', :project_id => 'ecookbook'
104
104
105 %w(Atom PDF CSV).each do |format|
105 %w(Atom PDF CSV).each do |format|
106 assert_tag :a, :content => format,
106 assert_tag :a, :content => format,
107 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
107 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
108 :rel => 'nofollow' }
108 :rel => 'nofollow' }
109 end
109 end
110 end
110 end
111
111
112 def test_pagination_links_on_get_index
112 def test_pagination_links_on_index
113 Setting.per_page_options = '2'
113 Setting.per_page_options = '2'
114 get '/projects/ecookbook/issues'
114 get '/projects/ecookbook/issues'
115
115
116 assert_tag :a, :content => '2',
116 assert_tag :a, :content => '2',
117 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
117 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
118
118
119 end
119 end
120
120
121 def test_pagination_links_on_post_index_without_project_id_in_url
121 def test_pagination_links_on_index_without_project_id_in_url
122 Setting.per_page_options = '2'
122 Setting.per_page_options = '2'
123 post '/issues', :project_id => 'ecookbook'
123 get '/issues', :project_id => 'ecookbook'
124
124
125 assert_tag :a, :content => '2',
125 assert_tag :a, :content => '2',
126 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
126 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
127
127
128 end
128 end
129
129
130 def test_issue_with_user_custom_field
130 def test_issue_with_user_custom_field
131 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :trackers => Tracker.all)
131 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :trackers => Tracker.all)
132 Role.anonymous.add_permission! :add_issues, :edit_issues
132 Role.anonymous.add_permission! :add_issues, :edit_issues
133 users = Project.find(1).users
133 users = Project.find(1).users
134 tester = users.first
134 tester = users.first
135
135
136 # Issue form
136 # Issue form
137 get '/projects/ecookbook/issues/new'
137 get '/projects/ecookbook/issues/new'
138 assert_response :success
138 assert_response :success
139 assert_tag :select,
139 assert_tag :select,
140 :attributes => {:name => "issue[custom_field_values][#{@field.id}]"},
140 :attributes => {:name => "issue[custom_field_values][#{@field.id}]"},
141 :children => {:count => (users.size + 1)}, # +1 for blank value
141 :children => {:count => (users.size + 1)}, # +1 for blank value
142 :child => {
142 :child => {
143 :tag => 'option',
143 :tag => 'option',
144 :attributes => {:value => tester.id.to_s},
144 :attributes => {:value => tester.id.to_s},
145 :content => tester.name
145 :content => tester.name
146 }
146 }
147
147
148 # Create issue
148 # Create issue
149 assert_difference 'Issue.count' do
149 assert_difference 'Issue.count' do
150 post '/projects/ecookbook/issues',
150 post '/projects/ecookbook/issues',
151 :issue => {
151 :issue => {
152 :tracker_id => '1',
152 :tracker_id => '1',
153 :priority_id => '4',
153 :priority_id => '4',
154 :subject => 'Issue with user custom field',
154 :subject => 'Issue with user custom field',
155 :custom_field_values => {@field.id.to_s => users.first.id.to_s}
155 :custom_field_values => {@field.id.to_s => users.first.id.to_s}
156 }
156 }
157 end
157 end
158 issue = Issue.first(:order => 'id DESC')
158 issue = Issue.first(:order => 'id DESC')
159 assert_response 302
159 assert_response 302
160
160
161 # Issue view
161 # Issue view
162 follow_redirect!
162 follow_redirect!
163 assert_tag :th,
163 assert_tag :th,
164 :content => /Tester/,
164 :content => /Tester/,
165 :sibling => {
165 :sibling => {
166 :tag => 'td',
166 :tag => 'td',
167 :content => tester.name
167 :content => tester.name
168 }
168 }
169 assert_tag :select,
169 assert_tag :select,
170 :attributes => {:name => "issue[custom_field_values][#{@field.id}]"},
170 :attributes => {:name => "issue[custom_field_values][#{@field.id}]"},
171 :children => {:count => (users.size + 1)}, # +1 for blank value
171 :children => {:count => (users.size + 1)}, # +1 for blank value
172 :child => {
172 :child => {
173 :tag => 'option',
173 :tag => 'option',
174 :attributes => {:value => tester.id.to_s, :selected => 'selected'},
174 :attributes => {:value => tester.id.to_s, :selected => 'selected'},
175 :content => tester.name
175 :content => tester.name
176 }
176 }
177
177
178 # Update issue
178 # Update issue
179 new_tester = users[1]
179 new_tester = users[1]
180 assert_difference 'Journal.count' do
180 assert_difference 'Journal.count' do
181 put "/issues/#{issue.id}",
181 put "/issues/#{issue.id}",
182 :notes => 'Updating custom field',
182 :notes => 'Updating custom field',
183 :issue => {
183 :issue => {
184 :custom_field_values => {@field.id.to_s => new_tester.id.to_s}
184 :custom_field_values => {@field.id.to_s => new_tester.id.to_s}
185 }
185 }
186 end
186 end
187 assert_response 302
187 assert_response 302
188
188
189 # Issue view
189 # Issue view
190 follow_redirect!
190 follow_redirect!
191 assert_tag :content => 'Tester',
191 assert_tag :content => 'Tester',
192 :ancestor => {:tag => 'ul', :attributes => {:class => /details/}},
192 :ancestor => {:tag => 'ul', :attributes => {:class => /details/}},
193 :sibling => {
193 :sibling => {
194 :content => tester.name,
194 :content => tester.name,
195 :sibling => {
195 :sibling => {
196 :content => new_tester.name
196 :content => new_tester.name
197 }
197 }
198 }
198 }
199 end
199 end
200 end
200 end
General Comments 0
You need to be logged in to leave comments. Login now