@@ -1,405 +1,412 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require 'uri' |
|
19 | 19 | require 'cgi' |
|
20 | 20 | |
|
21 | 21 | class ApplicationController < ActionController::Base |
|
22 | 22 | include Redmine::I18n |
|
23 | 23 | |
|
24 | 24 | layout 'base' |
|
25 | 25 | exempt_from_layout 'builder' |
|
26 | 26 | |
|
27 | 27 | # Remove broken cookie after upgrade from 0.8.x (#4292) |
|
28 | 28 | # See https://rails.lighthouseapp.com/projects/8994/tickets/3360 |
|
29 | 29 | # TODO: remove it when Rails is fixed |
|
30 | 30 | before_filter :delete_broken_cookies |
|
31 | 31 | def delete_broken_cookies |
|
32 | 32 | if cookies['_redmine_session'] && cookies['_redmine_session'] !~ /--/ |
|
33 | 33 | cookies.delete '_redmine_session' |
|
34 | 34 | redirect_to home_path |
|
35 | 35 | return false |
|
36 | 36 | end |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | before_filter :user_setup, :check_if_login_required, :set_localization |
|
40 | 40 | filter_parameter_logging :password |
|
41 | 41 | protect_from_forgery |
|
42 | 42 | |
|
43 | 43 | rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token |
|
44 | 44 | |
|
45 | 45 | include Redmine::Search::Controller |
|
46 | 46 | include Redmine::MenuManager::MenuController |
|
47 | 47 | helper Redmine::MenuManager::MenuHelper |
|
48 | 48 | |
|
49 | 49 | Redmine::Scm::Base.all.each do |scm| |
|
50 | 50 | require_dependency "repository/#{scm.underscore}" |
|
51 | 51 | end |
|
52 | 52 | |
|
53 | 53 | def user_setup |
|
54 | 54 | # Check the settings cache for each request |
|
55 | 55 | Setting.check_cache |
|
56 | 56 | # Find the current user |
|
57 | 57 | User.current = find_current_user |
|
58 | 58 | end |
|
59 | 59 | |
|
60 | 60 | # Returns the current user or nil if no user is logged in |
|
61 | 61 | # and starts a session if needed |
|
62 | 62 | def find_current_user |
|
63 | 63 | if session[:user_id] |
|
64 | 64 | # existing session |
|
65 | 65 | (User.active.find(session[:user_id]) rescue nil) |
|
66 | 66 | elsif cookies[:autologin] && Setting.autologin? |
|
67 | 67 | # auto-login feature starts a new session |
|
68 | 68 | user = User.try_to_autologin(cookies[:autologin]) |
|
69 | 69 | session[:user_id] = user.id if user |
|
70 | 70 | user |
|
71 | 71 | elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action]) |
|
72 | 72 | # RSS key authentication does not start a session |
|
73 | 73 | User.find_by_rss_key(params[:key]) |
|
74 | 74 | elsif Setting.rest_api_enabled? && ['xml', 'json'].include?(params[:format]) |
|
75 | 75 | if params[:key].present? && accept_key_auth_actions.include?(params[:action]) |
|
76 | 76 | # Use API key |
|
77 | 77 | User.find_by_api_key(params[:key]) |
|
78 | 78 | else |
|
79 | 79 | # HTTP Basic, either username/password or API key/random |
|
80 | 80 | authenticate_with_http_basic do |username, password| |
|
81 | 81 | User.try_to_login(username, password) || User.find_by_api_key(username) |
|
82 | 82 | end |
|
83 | 83 | end |
|
84 | 84 | end |
|
85 | 85 | end |
|
86 | 86 | |
|
87 | 87 | # Sets the logged in user |
|
88 | 88 | def logged_user=(user) |
|
89 | 89 | reset_session |
|
90 | 90 | if user && user.is_a?(User) |
|
91 | 91 | User.current = user |
|
92 | 92 | session[:user_id] = user.id |
|
93 | 93 | else |
|
94 | 94 | User.current = User.anonymous |
|
95 | 95 | end |
|
96 | 96 | end |
|
97 | 97 | |
|
98 | 98 | # check if login is globally required to access the application |
|
99 | 99 | def check_if_login_required |
|
100 | 100 | # no check needed if user is already logged in |
|
101 | 101 | return true if User.current.logged? |
|
102 | 102 | require_login if Setting.login_required? |
|
103 | 103 | end |
|
104 | 104 | |
|
105 | 105 | def set_localization |
|
106 | 106 | lang = nil |
|
107 | 107 | if User.current.logged? |
|
108 | 108 | lang = find_language(User.current.language) |
|
109 | 109 | end |
|
110 | 110 | if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE'] |
|
111 | 111 | accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first |
|
112 | 112 | if !accept_lang.blank? |
|
113 | 113 | accept_lang = accept_lang.downcase |
|
114 | 114 | lang = find_language(accept_lang) || find_language(accept_lang.split('-').first) |
|
115 | 115 | end |
|
116 | 116 | end |
|
117 | 117 | lang ||= Setting.default_language |
|
118 | 118 | set_language_if_valid(lang) |
|
119 | 119 | end |
|
120 | 120 | |
|
121 | 121 | def require_login |
|
122 | 122 | if !User.current.logged? |
|
123 | 123 | # Extract only the basic url parameters on non-GET requests |
|
124 | 124 | if request.get? |
|
125 | 125 | url = url_for(params) |
|
126 | 126 | else |
|
127 | 127 | url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id]) |
|
128 | 128 | end |
|
129 | 129 | respond_to do |format| |
|
130 | 130 | format.html { redirect_to :controller => "account", :action => "login", :back_url => url } |
|
131 | 131 | format.atom { redirect_to :controller => "account", :action => "login", :back_url => url } |
|
132 | 132 | format.xml { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' } |
|
133 | 133 | format.js { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' } |
|
134 | 134 | format.json { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' } |
|
135 | 135 | end |
|
136 | 136 | return false |
|
137 | 137 | end |
|
138 | 138 | true |
|
139 | 139 | end |
|
140 | 140 | |
|
141 | 141 | def require_admin |
|
142 | 142 | return unless require_login |
|
143 | 143 | if !User.current.admin? |
|
144 | 144 | render_403 |
|
145 | 145 | return false |
|
146 | 146 | end |
|
147 | 147 | true |
|
148 | 148 | end |
|
149 | 149 | |
|
150 | 150 | def deny_access |
|
151 | 151 | User.current.logged? ? render_403 : require_login |
|
152 | 152 | end |
|
153 | 153 | |
|
154 | 154 | # Authorize the user for the requested action |
|
155 | 155 | def authorize(ctrl = params[:controller], action = params[:action], global = false) |
|
156 | 156 | allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global) |
|
157 | 157 | allowed ? true : deny_access |
|
158 | 158 | end |
|
159 | 159 | |
|
160 | 160 | # Authorize the user for the requested action outside a project |
|
161 | 161 | def authorize_global(ctrl = params[:controller], action = params[:action], global = true) |
|
162 | 162 | authorize(ctrl, action, global) |
|
163 | 163 | end |
|
164 | 164 | |
|
165 | 165 | # Find project of id params[:id] |
|
166 | 166 | def find_project |
|
167 | 167 | @project = Project.find(params[:id]) |
|
168 | 168 | rescue ActiveRecord::RecordNotFound |
|
169 | 169 | render_404 |
|
170 | 170 | end |
|
171 | 171 | |
|
172 | # Find project of id params[:project_id] | |
|
173 | def find_project_by_project_id | |
|
174 | @project = Project.find(params[:project_id]) | |
|
175 | rescue ActiveRecord::RecordNotFound | |
|
176 | render_404 | |
|
177 | end | |
|
178 | ||
|
172 | 179 | # Find a project based on params[:project_id] |
|
173 | 180 | # TODO: some subclasses override this, see about merging their logic |
|
174 | 181 | def find_optional_project |
|
175 | 182 | @project = Project.find(params[:project_id]) unless params[:project_id].blank? |
|
176 | 183 | allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true) |
|
177 | 184 | allowed ? true : deny_access |
|
178 | 185 | rescue ActiveRecord::RecordNotFound |
|
179 | 186 | render_404 |
|
180 | 187 | end |
|
181 | 188 | |
|
182 | 189 | # Finds and sets @project based on @object.project |
|
183 | 190 | def find_project_from_association |
|
184 | 191 | render_404 unless @object.present? |
|
185 | 192 | |
|
186 | 193 | @project = @object.project |
|
187 | 194 | rescue ActiveRecord::RecordNotFound |
|
188 | 195 | render_404 |
|
189 | 196 | end |
|
190 | 197 | |
|
191 | 198 | def find_model_object |
|
192 | 199 | model = self.class.read_inheritable_attribute('model_object') |
|
193 | 200 | if model |
|
194 | 201 | @object = model.find(params[:id]) |
|
195 | 202 | self.instance_variable_set('@' + controller_name.singularize, @object) if @object |
|
196 | 203 | end |
|
197 | 204 | rescue ActiveRecord::RecordNotFound |
|
198 | 205 | render_404 |
|
199 | 206 | end |
|
200 | 207 | |
|
201 | 208 | def self.model_object(model) |
|
202 | 209 | write_inheritable_attribute('model_object', model) |
|
203 | 210 | end |
|
204 | 211 | |
|
205 | 212 | # Filter for bulk issue operations |
|
206 | 213 | def find_issues |
|
207 | 214 | @issues = Issue.find_all_by_id(params[:id] || params[:ids]) |
|
208 | 215 | raise ActiveRecord::RecordNotFound if @issues.empty? |
|
209 | 216 | projects = @issues.collect(&:project).compact.uniq |
|
210 | 217 | if projects.size == 1 |
|
211 | 218 | @project = projects.first |
|
212 | 219 | else |
|
213 | 220 | # TODO: let users bulk edit/move/destroy issues from different projects |
|
214 | 221 | render_error 'Can not bulk edit/move/destroy issues from different projects' |
|
215 | 222 | return false |
|
216 | 223 | end |
|
217 | 224 | rescue ActiveRecord::RecordNotFound |
|
218 | 225 | render_404 |
|
219 | 226 | end |
|
220 | 227 | |
|
221 | 228 | # make sure that the user is a member of the project (or admin) if project is private |
|
222 | 229 | # used as a before_filter for actions that do not require any particular permission on the project |
|
223 | 230 | def check_project_privacy |
|
224 | 231 | if @project && @project.active? |
|
225 | 232 | if @project.is_public? || User.current.member_of?(@project) || User.current.admin? |
|
226 | 233 | true |
|
227 | 234 | else |
|
228 | 235 | User.current.logged? ? render_403 : require_login |
|
229 | 236 | end |
|
230 | 237 | else |
|
231 | 238 | @project = nil |
|
232 | 239 | render_404 |
|
233 | 240 | false |
|
234 | 241 | end |
|
235 | 242 | end |
|
236 | 243 | |
|
237 | 244 | def back_url |
|
238 | 245 | params[:back_url] || request.env['HTTP_REFERER'] |
|
239 | 246 | end |
|
240 | 247 | |
|
241 | 248 | def redirect_back_or_default(default) |
|
242 | 249 | back_url = CGI.unescape(params[:back_url].to_s) |
|
243 | 250 | if !back_url.blank? |
|
244 | 251 | begin |
|
245 | 252 | uri = URI.parse(back_url) |
|
246 | 253 | # do not redirect user to another host or to the login or register page |
|
247 | 254 | if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) |
|
248 | 255 | redirect_to(back_url) |
|
249 | 256 | return |
|
250 | 257 | end |
|
251 | 258 | rescue URI::InvalidURIError |
|
252 | 259 | # redirect to default |
|
253 | 260 | end |
|
254 | 261 | end |
|
255 | 262 | redirect_to default |
|
256 | 263 | end |
|
257 | 264 | |
|
258 | 265 | def render_403 |
|
259 | 266 | @project = nil |
|
260 | 267 | respond_to do |format| |
|
261 | 268 | format.html { render :template => "common/403", :layout => use_layout, :status => 403 } |
|
262 | 269 | format.atom { head 403 } |
|
263 | 270 | format.xml { head 403 } |
|
264 | 271 | format.js { head 403 } |
|
265 | 272 | format.json { head 403 } |
|
266 | 273 | end |
|
267 | 274 | return false |
|
268 | 275 | end |
|
269 | 276 | |
|
270 | 277 | def render_404 |
|
271 | 278 | respond_to do |format| |
|
272 | 279 | format.html { render :template => "common/404", :layout => use_layout, :status => 404 } |
|
273 | 280 | format.atom { head 404 } |
|
274 | 281 | format.xml { head 404 } |
|
275 | 282 | format.js { head 404 } |
|
276 | 283 | format.json { head 404 } |
|
277 | 284 | end |
|
278 | 285 | return false |
|
279 | 286 | end |
|
280 | 287 | |
|
281 | 288 | def render_error(msg) |
|
282 | 289 | respond_to do |format| |
|
283 | 290 | format.html { |
|
284 | 291 | flash.now[:error] = msg |
|
285 | 292 | render :text => '', :layout => use_layout, :status => 500 |
|
286 | 293 | } |
|
287 | 294 | format.atom { head 500 } |
|
288 | 295 | format.xml { head 500 } |
|
289 | 296 | format.js { head 500 } |
|
290 | 297 | format.json { head 500 } |
|
291 | 298 | end |
|
292 | 299 | end |
|
293 | 300 | |
|
294 | 301 | # Picks which layout to use based on the request |
|
295 | 302 | # |
|
296 | 303 | # @return [boolean, string] name of the layout to use or false for no layout |
|
297 | 304 | def use_layout |
|
298 | 305 | request.xhr? ? false : 'base' |
|
299 | 306 | end |
|
300 | 307 | |
|
301 | 308 | def invalid_authenticity_token |
|
302 | 309 | if api_request? |
|
303 | 310 | logger.error "Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)." |
|
304 | 311 | end |
|
305 | 312 | render_error "Invalid form authenticity token." |
|
306 | 313 | end |
|
307 | 314 | |
|
308 | 315 | def render_feed(items, options={}) |
|
309 | 316 | @items = items || [] |
|
310 | 317 | @items.sort! {|x,y| y.event_datetime <=> x.event_datetime } |
|
311 | 318 | @items = @items.slice(0, Setting.feeds_limit.to_i) |
|
312 | 319 | @title = options[:title] || Setting.app_title |
|
313 | 320 | render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml' |
|
314 | 321 | end |
|
315 | 322 | |
|
316 | 323 | def self.accept_key_auth(*actions) |
|
317 | 324 | actions = actions.flatten.map(&:to_s) |
|
318 | 325 | write_inheritable_attribute('accept_key_auth_actions', actions) |
|
319 | 326 | end |
|
320 | 327 | |
|
321 | 328 | def accept_key_auth_actions |
|
322 | 329 | self.class.read_inheritable_attribute('accept_key_auth_actions') || [] |
|
323 | 330 | end |
|
324 | 331 | |
|
325 | 332 | # Returns the number of objects that should be displayed |
|
326 | 333 | # on the paginated list |
|
327 | 334 | def per_page_option |
|
328 | 335 | per_page = nil |
|
329 | 336 | if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i) |
|
330 | 337 | per_page = params[:per_page].to_s.to_i |
|
331 | 338 | session[:per_page] = per_page |
|
332 | 339 | elsif session[:per_page] |
|
333 | 340 | per_page = session[:per_page] |
|
334 | 341 | else |
|
335 | 342 | per_page = Setting.per_page_options_array.first || 25 |
|
336 | 343 | end |
|
337 | 344 | per_page |
|
338 | 345 | end |
|
339 | 346 | |
|
340 | 347 | # qvalues http header parser |
|
341 | 348 | # code taken from webrick |
|
342 | 349 | def parse_qvalues(value) |
|
343 | 350 | tmp = [] |
|
344 | 351 | if value |
|
345 | 352 | parts = value.split(/,\s*/) |
|
346 | 353 | parts.each {|part| |
|
347 | 354 | if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part) |
|
348 | 355 | val = m[1] |
|
349 | 356 | q = (m[2] or 1).to_f |
|
350 | 357 | tmp.push([val, q]) |
|
351 | 358 | end |
|
352 | 359 | } |
|
353 | 360 | tmp = tmp.sort_by{|val, q| -q} |
|
354 | 361 | tmp.collect!{|val, q| val} |
|
355 | 362 | end |
|
356 | 363 | return tmp |
|
357 | 364 | rescue |
|
358 | 365 | nil |
|
359 | 366 | end |
|
360 | 367 | |
|
361 | 368 | # Returns a string that can be used as filename value in Content-Disposition header |
|
362 | 369 | def filename_for_content_disposition(name) |
|
363 | 370 | request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name |
|
364 | 371 | end |
|
365 | 372 | |
|
366 | 373 | def api_request? |
|
367 | 374 | %w(xml json).include? params[:format] |
|
368 | 375 | end |
|
369 | 376 | |
|
370 | 377 | # Renders a warning flash if obj has unsaved attachments |
|
371 | 378 | def render_attachment_warning_if_needed(obj) |
|
372 | 379 | flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present? |
|
373 | 380 | end |
|
374 | 381 | |
|
375 | 382 | # Sets the `flash` notice or error based the number of issues that did not save |
|
376 | 383 | # |
|
377 | 384 | # @param [Array, Issue] issues all of the saved and unsaved Issues |
|
378 | 385 | # @param [Array, Integer] unsaved_issue_ids the issue ids that were not saved |
|
379 | 386 | def set_flash_from_bulk_issue_save(issues, unsaved_issue_ids) |
|
380 | 387 | if unsaved_issue_ids.empty? |
|
381 | 388 | flash[:notice] = l(:notice_successful_update) unless issues.empty? |
|
382 | 389 | else |
|
383 | 390 | flash[:error] = l(:notice_failed_to_save_issues, |
|
384 | 391 | :count => unsaved_issue_ids.size, |
|
385 | 392 | :total => issues.size, |
|
386 | 393 | :ids => '#' + unsaved_issue_ids.join(', #')) |
|
387 | 394 | end |
|
388 | 395 | end |
|
389 | 396 | |
|
390 | 397 | # Rescues an invalid query statement. Just in case... |
|
391 | 398 | def query_statement_invalid(exception) |
|
392 | 399 | logger.error "Query::StatementInvalid: #{exception.message}" if logger |
|
393 | 400 | session.delete(:query) |
|
394 | 401 | sort_clear if respond_to?(:sort_clear) |
|
395 | 402 | render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator." |
|
396 | 403 | end |
|
397 | 404 | |
|
398 | 405 | # Converts the errors on an ActiveRecord object into a common JSON format |
|
399 | 406 | def object_errors_to_json(object) |
|
400 | 407 | object.errors.collect do |attribute, error| |
|
401 | 408 | { attribute => error } |
|
402 | 409 | end.to_json |
|
403 | 410 | end |
|
404 | 411 | |
|
405 | 412 | end |
@@ -1,26 +1,26 | |||
|
1 | 1 | class ProjectEnumerationsController < ApplicationController |
|
2 | before_filter :find_project | |
|
2 | before_filter :find_project_by_project_id | |
|
3 | 3 | before_filter :authorize |
|
4 | 4 | |
|
5 |
def |
|
|
6 |
if request.p |
|
|
5 | def update | |
|
6 | if request.put? && params[:enumerations] | |
|
7 | 7 | Project.transaction do |
|
8 | 8 | params[:enumerations].each do |id, activity| |
|
9 | 9 | @project.update_or_create_time_entry_activity(id, activity) |
|
10 | 10 | end |
|
11 | 11 | end |
|
12 | 12 | flash[:notice] = l(:notice_successful_update) |
|
13 | 13 | end |
|
14 | 14 | |
|
15 | 15 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project |
|
16 | 16 | end |
|
17 | 17 | |
|
18 | 18 | def destroy |
|
19 | 19 | @project.time_entry_activities.each do |time_entry_activity| |
|
20 | 20 | time_entry_activity.destroy(time_entry_activity.parent) |
|
21 | 21 | end |
|
22 | 22 | flash[:notice] = l(:notice_successful_update) |
|
23 | 23 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | end |
@@ -1,42 +1,42 | |||
|
1 |
<% form_tag( |
|
|
1 | <% form_tag(project_project_enumerations_path(@project), :method => :put, :class => "tabular") do %> | |
|
2 | 2 | |
|
3 | 3 | <table class="list"> |
|
4 | 4 | <thead><tr> |
|
5 | 5 | <th><%= l(:field_name) %></th> |
|
6 | 6 | <th><%= l(:enumeration_system_activity) %></th> |
|
7 | 7 | <% TimeEntryActivity.new.available_custom_fields.each do |value| %> |
|
8 | 8 | <th><%= h value.name %></th> |
|
9 | 9 | <% end %> |
|
10 | 10 | <th style="width:15%;"><%= l(:field_active) %></th> |
|
11 | 11 | </tr></thead> |
|
12 | 12 | |
|
13 | 13 | <% @project.activities(true).each do |enumeration| %> |
|
14 | 14 | <% fields_for "enumerations[#{enumeration.id}]", enumeration do |ff| %> |
|
15 | 15 | <tr class="<%= cycle('odd', 'even') %>"> |
|
16 | 16 | <td> |
|
17 | 17 | <%= ff.hidden_field :parent_id, :value => enumeration.id unless enumeration.project %> |
|
18 | 18 | <%= h(enumeration) %> |
|
19 | 19 | </td> |
|
20 | 20 | <td align="center" style="width:15%;"><%= checked_image !enumeration.project %></td> |
|
21 | 21 | <% enumeration.custom_field_values.each do |value| %> |
|
22 | 22 | <td align="center"> |
|
23 | 23 | <%= custom_field_tag "enumerations[#{enumeration.id}]", value %> |
|
24 | 24 | </td> |
|
25 | 25 | <% end %> |
|
26 | 26 | <td align="center" style="width:15%;"> |
|
27 | 27 | <%= ff.check_box :active %> |
|
28 | 28 | </td> |
|
29 | 29 | </tr> |
|
30 | 30 | <% end %> |
|
31 | 31 | <% end %> |
|
32 | 32 | </table> |
|
33 | 33 | |
|
34 | 34 | <div class="contextual"> |
|
35 |
<%= link_to(l(:button_reset), |
|
|
35 | <%= link_to(l(:button_reset), project_project_enumerations_path(@project), | |
|
36 | 36 | :method => :delete, |
|
37 | 37 | :confirm => l(:text_are_you_sure), |
|
38 | 38 | :class => 'icon icon-del') %> |
|
39 | 39 | </div> |
|
40 | 40 | |
|
41 | 41 | <%= submit_tag l(:button_save) %> |
|
42 | 42 | <% end %> |
@@ -1,281 +1,277 | |||
|
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.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' |
|
18 | 18 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
19 | 19 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
20 | 20 | |
|
21 | 21 | map.with_options :controller => 'timelog' do |timelog| |
|
22 | 22 | timelog.connect 'projects/:project_id/time_entries', :action => 'details' |
|
23 | 23 | |
|
24 | 24 | timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details| |
|
25 | 25 | time_details.connect 'time_entries' |
|
26 | 26 | time_details.connect 'time_entries.:format' |
|
27 | 27 | time_details.connect 'issues/:issue_id/time_entries' |
|
28 | 28 | time_details.connect 'issues/:issue_id/time_entries.:format' |
|
29 | 29 | time_details.connect 'projects/:project_id/time_entries.:format' |
|
30 | 30 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' |
|
31 | 31 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' |
|
32 | 32 | end |
|
33 | 33 | timelog.connect 'projects/:project_id/time_entries/report', :action => 'report' |
|
34 | 34 | timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report| |
|
35 | 35 | time_report.connect 'time_entries/report' |
|
36 | 36 | time_report.connect 'time_entries/report.:format' |
|
37 | 37 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
38 | 38 | end |
|
39 | 39 | |
|
40 | 40 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| |
|
41 | 41 | time_edit.connect 'issues/:issue_id/time_entries/new' |
|
42 | 42 | end |
|
43 | 43 | |
|
44 | 44 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} |
|
45 | 45 | end |
|
46 | 46 | |
|
47 | 47 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
48 | 48 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
49 | 49 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
50 | 50 | map.with_options :controller => 'wiki' do |wiki_routes| |
|
51 | 51 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| |
|
52 | 52 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i |
|
53 | 53 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil |
|
54 | 54 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' |
|
55 | 55 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' |
|
56 | 56 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' |
|
57 | 57 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' |
|
58 | 58 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' |
|
59 | 59 | end |
|
60 | 60 | |
|
61 | 61 | wiki_routes.connect 'projects/:id/wiki/:page/:action', |
|
62 | 62 | :action => /edit|rename|destroy|preview|protect/, |
|
63 | 63 | :conditions => {:method => :post} |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | map.with_options :controller => 'messages' do |messages_routes| |
|
67 | 67 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
68 | 68 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
69 | 69 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
70 | 70 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
71 | 71 | end |
|
72 | 72 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
73 | 73 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
74 | 74 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
75 | 75 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
76 | 76 | end |
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | map.with_options :controller => 'boards' do |board_routes| |
|
80 | 80 | board_routes.with_options :conditions => {:method => :get} do |board_views| |
|
81 | 81 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
82 | 82 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
83 | 83 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
84 | 84 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' |
|
85 | 85 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
86 | 86 | end |
|
87 | 87 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
|
88 | 88 | board_actions.connect 'projects/:project_id/boards', :action => 'new' |
|
89 | 89 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ |
|
90 | 90 | end |
|
91 | 91 | end |
|
92 | 92 | |
|
93 | 93 | map.with_options :controller => 'documents' do |document_routes| |
|
94 | 94 | document_routes.with_options :conditions => {:method => :get} do |document_views| |
|
95 | 95 | document_views.connect 'projects/:project_id/documents', :action => 'index' |
|
96 | 96 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' |
|
97 | 97 | document_views.connect 'documents/:id', :action => 'show' |
|
98 | 98 | document_views.connect 'documents/:id/edit', :action => 'edit' |
|
99 | 99 | end |
|
100 | 100 | document_routes.with_options :conditions => {:method => :post} do |document_actions| |
|
101 | 101 | document_actions.connect 'projects/:project_id/documents', :action => 'new' |
|
102 | 102 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ |
|
103 | 103 | end |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' |
|
107 | 107 | |
|
108 | 108 | # Misc issue routes. TODO: move into resources |
|
109 | 109 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' |
|
110 | 110 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview |
|
111 | 111 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
112 | 112 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
113 | 113 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } |
|
114 | 114 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } |
|
115 | 115 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } |
|
116 | 116 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy |
|
117 | 117 | |
|
118 | 118 | map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update] |
|
119 | 119 | map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update] |
|
120 | 120 | map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update] |
|
121 | 121 | map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update] |
|
122 | 122 | |
|
123 | 123 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
124 | 124 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
125 | 125 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
126 | 126 | end |
|
127 | 127 | |
|
128 | 128 | # Following two routes conflict with the resources because #index allows POST |
|
129 | 129 | map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
130 | 130 | map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
131 | 131 | |
|
132 | 132 | map.resources :issues, :member => { :edit => :post }, :collection => {} |
|
133 | 133 | map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } |
|
134 | 134 | |
|
135 | 135 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| |
|
136 | 136 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' |
|
137 | 137 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' |
|
138 | 138 | end |
|
139 | 139 | |
|
140 | 140 | map.with_options :controller => 'news' do |news_routes| |
|
141 | 141 | news_routes.with_options :conditions => {:method => :get} do |news_views| |
|
142 | 142 | news_views.connect 'news', :action => 'index' |
|
143 | 143 | news_views.connect 'projects/:project_id/news', :action => 'index' |
|
144 | 144 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' |
|
145 | 145 | news_views.connect 'news.:format', :action => 'index' |
|
146 | 146 | news_views.connect 'projects/:project_id/news/new', :action => 'new' |
|
147 | 147 | news_views.connect 'news/:id', :action => 'show' |
|
148 | 148 | news_views.connect 'news/:id/edit', :action => 'edit' |
|
149 | 149 | end |
|
150 | 150 | news_routes.with_options do |news_actions| |
|
151 | 151 | news_actions.connect 'projects/:project_id/news', :action => 'new' |
|
152 | 152 | news_actions.connect 'news/:id/edit', :action => 'edit' |
|
153 | 153 | news_actions.connect 'news/:id/destroy', :action => 'destroy' |
|
154 | 154 | end |
|
155 | 155 | end |
|
156 | 156 | |
|
157 | 157 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
158 | 158 | |
|
159 | 159 | map.with_options :controller => 'users' do |users| |
|
160 | 160 | users.with_options :conditions => {:method => :get} do |user_views| |
|
161 | 161 | user_views.connect 'users', :action => 'index' |
|
162 | 162 | user_views.connect 'users/:id', :action => 'show', :id => /\d+/ |
|
163 | 163 | user_views.connect 'users/new', :action => 'add' |
|
164 | 164 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil |
|
165 | 165 | end |
|
166 | 166 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
167 | 167 | user_actions.connect 'users', :action => 'add' |
|
168 | 168 | user_actions.connect 'users/new', :action => 'add' |
|
169 | 169 | user_actions.connect 'users/:id/edit', :action => 'edit' |
|
170 | 170 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
171 | 171 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
172 | 172 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
173 | 173 | end |
|
174 | 174 | end |
|
175 | 175 | |
|
176 | 176 | map.resources :projects, :member => { |
|
177 | 177 | :copy => [:get, :post], |
|
178 | 178 | :settings => :get, |
|
179 | 179 | :modules => :post, |
|
180 | 180 | :archive => :post, |
|
181 | 181 | :unarchive => :post |
|
182 | } | |
|
182 | } do |project| | |
|
183 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | |
|
184 | end | |
|
183 | 185 | |
|
184 | 186 | # Destroy uses a get request to prompt the user before the actual DELETE request |
|
185 | 187 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} |
|
186 | 188 | |
|
187 | 189 | # TODO: port to be part of the resources route(s) |
|
188 | 190 | map.with_options :controller => 'projects' do |project_mapper| |
|
189 | 191 | project_mapper.with_options :conditions => {:method => :get} do |project_views| |
|
190 | 192 | project_views.connect 'projects/:id/files', :controller => 'files', :action => 'index' |
|
191 | 193 | project_views.connect 'projects/:id/files/new', :controller => 'files', :action => 'new' |
|
192 | 194 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' |
|
193 | 195 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' |
|
194 | 196 | end |
|
195 | 197 | |
|
196 | 198 | project_mapper.with_options :conditions => {:method => :post} do |project_actions| |
|
197 | 199 | project_actions.connect 'projects/:id/files/new', :controller => 'files', :action => 'new' |
|
198 | project_actions.connect 'projects/:id/activities/save', :controller => 'project_enumerations', :action => 'save' | |
|
199 | end | |
|
200 | ||
|
201 | project_mapper.with_options :conditions => {:method => :delete} do |project_actions| | |
|
202 | project_actions.conditions 'projects/:id/reset_activities', :controller => 'project_enumerations', :action => 'destroy' | |
|
203 | 200 | end |
|
204 | ||
|
205 | 201 | end |
|
206 | 202 | |
|
207 | 203 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| |
|
208 | 204 | activity.connect 'projects/:id/activity' |
|
209 | 205 | activity.connect 'projects/:id/activity.:format' |
|
210 | 206 | activity.connect 'activity', :id => nil |
|
211 | 207 | activity.connect 'activity.:format', :id => nil |
|
212 | 208 | end |
|
213 | 209 | |
|
214 | 210 | map.with_options :controller => 'versions' do |versions| |
|
215 | 211 | versions.connect 'projects/:project_id/versions/new', :action => 'new' |
|
216 | 212 | versions.connect 'projects/:project_id/roadmap', :action => 'index' |
|
217 | 213 | versions.with_options :conditions => {:method => :post} do |version_actions| |
|
218 | 214 | version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed' |
|
219 | 215 | end |
|
220 | 216 | end |
|
221 | 217 | |
|
222 | 218 | map.with_options :controller => 'issue_categories' do |categories| |
|
223 | 219 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' |
|
224 | 220 | end |
|
225 | 221 | |
|
226 | 222 | map.with_options :controller => 'repositories' do |repositories| |
|
227 | 223 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
228 | 224 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
229 | 225 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
230 | 226 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
231 | 227 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
232 | 228 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
233 | 229 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
234 | 230 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
235 | 231 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
236 | 232 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
237 | 233 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
238 | 234 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
239 | 235 | # TODO: why the following route is required? |
|
240 | 236 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
241 | 237 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
242 | 238 | end |
|
243 | 239 | |
|
244 | 240 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
245 | 241 | end |
|
246 | 242 | |
|
247 | 243 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
248 | 244 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
249 | 245 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
250 | 246 | |
|
251 | 247 | map.resources :groups |
|
252 | 248 | |
|
253 | 249 | #left old routes at the bottom for backwards compat |
|
254 | 250 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
255 | 251 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
256 | 252 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
257 | 253 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
258 | 254 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
259 | 255 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' |
|
260 | 256 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
261 | 257 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
262 | 258 | map.with_options :controller => 'repositories' do |omap| |
|
263 | 259 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
264 | 260 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
265 | 261 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
266 | 262 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
267 | 263 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
268 | 264 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
269 | 265 | end |
|
270 | 266 | |
|
271 | 267 | map.with_options :controller => 'sys' do |sys| |
|
272 | 268 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
273 | 269 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
274 | 270 | end |
|
275 | 271 | |
|
276 | 272 | # Install the default route as the lowest priority. |
|
277 | 273 | map.connect ':controller/:action/:id' |
|
278 | 274 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
279 | 275 | # Used for OpenID |
|
280 | 276 | map.root :controller => 'account', :action => 'login' |
|
281 | 277 | end |
@@ -1,230 +1,230 | |||
|
1 | 1 | require 'redmine/access_control' |
|
2 | 2 | require 'redmine/menu_manager' |
|
3 | 3 | require 'redmine/activity' |
|
4 | 4 | require 'redmine/search' |
|
5 | 5 | require 'redmine/custom_field_format' |
|
6 | 6 | require 'redmine/mime_type' |
|
7 | 7 | require 'redmine/core_ext' |
|
8 | 8 | require 'redmine/themes' |
|
9 | 9 | require 'redmine/hook' |
|
10 | 10 | require 'redmine/plugin' |
|
11 | 11 | require 'redmine/wiki_formatting' |
|
12 | 12 | require 'redmine/scm/base' |
|
13 | 13 | |
|
14 | 14 | begin |
|
15 | 15 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) |
|
16 | 16 | rescue LoadError |
|
17 | 17 | # RMagick is not available |
|
18 | 18 | end |
|
19 | 19 | |
|
20 | 20 | if RUBY_VERSION < '1.9' |
|
21 | 21 | require 'faster_csv' |
|
22 | 22 | else |
|
23 | 23 | require 'csv' |
|
24 | 24 | FCSV = CSV |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | Redmine::Scm::Base.add "Subversion" |
|
28 | 28 | Redmine::Scm::Base.add "Darcs" |
|
29 | 29 | Redmine::Scm::Base.add "Mercurial" |
|
30 | 30 | Redmine::Scm::Base.add "Cvs" |
|
31 | 31 | Redmine::Scm::Base.add "Bazaar" |
|
32 | 32 | Redmine::Scm::Base.add "Git" |
|
33 | 33 | Redmine::Scm::Base.add "Filesystem" |
|
34 | 34 | |
|
35 | 35 | Redmine::CustomFieldFormat.map do |fields| |
|
36 | 36 | fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1) |
|
37 | 37 | fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2) |
|
38 | 38 | fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3) |
|
39 | 39 | fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4) |
|
40 | 40 | fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5) |
|
41 | 41 | fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6) |
|
42 | 42 | fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7) |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | # Permissions |
|
46 | 46 | Redmine::AccessControl.map do |map| |
|
47 | 47 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true |
|
48 | 48 | map.permission :search_project, {:search => :index}, :public => true |
|
49 | 49 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
50 | 50 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
51 | 51 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
52 | 52 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
53 | 53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :close_completed, :destroy]}, :require => :member |
|
54 | 54 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
55 | 55 | |
|
56 | 56 | map.project_module :issue_tracking do |map| |
|
57 | 57 | # Issue categories |
|
58 | 58 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member |
|
59 | 59 | # Issues |
|
60 | 60 | map.permission :view_issues, {:issues => [:index, :show], |
|
61 | 61 | :auto_complete => [:issues], |
|
62 | 62 | :context_menus => [:issues], |
|
63 | 63 | :versions => [:index, :show, :status_by], |
|
64 | 64 | :journals => :index, |
|
65 | 65 | :queries => :index, |
|
66 | 66 | :reports => [:issue_report, :issue_report_details]} |
|
67 | 67 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} |
|
68 | 68 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} |
|
69 | 69 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} |
|
70 | 70 | map.permission :manage_subtasks, {} |
|
71 | 71 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} |
|
72 | 72 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
73 | 73 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
74 | 74 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin |
|
75 | 75 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
76 | 76 | # Queries |
|
77 | 77 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
|
78 | 78 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin |
|
79 | 79 | # Watchers |
|
80 | 80 | map.permission :view_issue_watchers, {} |
|
81 | 81 | map.permission :add_issue_watchers, {:watchers => :new} |
|
82 | 82 | map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
83 | 83 | end |
|
84 | 84 | |
|
85 | 85 | map.project_module :time_tracking do |map| |
|
86 | 86 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin |
|
87 | 87 | map.permission :view_time_entries, :timelog => [:details, :report] |
|
88 | 88 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member |
|
89 | 89 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin |
|
90 |
map.permission :manage_project_activities, {:project_enumerations => [: |
|
|
90 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member | |
|
91 | 91 | end |
|
92 | 92 | |
|
93 | 93 | map.project_module :news do |map| |
|
94 | 94 | map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member |
|
95 | 95 | map.permission :view_news, {:news => [:index, :show]}, :public => true |
|
96 | 96 | map.permission :comment_news, {:news => :add_comment} |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | map.project_module :documents do |map| |
|
100 | 100 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin |
|
101 | 101 | map.permission :view_documents, :documents => [:index, :show, :download] |
|
102 | 102 | end |
|
103 | 103 | |
|
104 | 104 | map.project_module :files do |map| |
|
105 | 105 | map.permission :manage_files, {:files => :new}, :require => :loggedin |
|
106 | 106 | map.permission :view_files, :files => :index, :versions => :download |
|
107 | 107 | end |
|
108 | 108 | |
|
109 | 109 | map.project_module :wiki do |map| |
|
110 | 110 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
111 | 111 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
112 | 112 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
113 | 113 | map.permission :view_wiki_pages, :wiki => [:index, :special] |
|
114 | 114 | map.permission :export_wiki_pages, {} |
|
115 | 115 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] |
|
116 | 116 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] |
|
117 | 117 | map.permission :delete_wiki_pages_attachments, {} |
|
118 | 118 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
119 | 119 | end |
|
120 | 120 | |
|
121 | 121 | map.project_module :repository do |map| |
|
122 | 122 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member |
|
123 | 123 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
|
124 | 124 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
125 | 125 | map.permission :commit_access, {} |
|
126 | 126 | end |
|
127 | 127 | |
|
128 | 128 | map.project_module :boards do |map| |
|
129 | 129 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
130 | 130 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
131 | 131 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} |
|
132 | 132 | map.permission :edit_messages, {:messages => :edit}, :require => :member |
|
133 | 133 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin |
|
134 | 134 | map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
135 | 135 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
136 | 136 | end |
|
137 | 137 | |
|
138 | 138 | map.project_module :calendar do |map| |
|
139 | 139 | map.permission :view_calendar, :calendars => [:show, :update] |
|
140 | 140 | end |
|
141 | 141 | |
|
142 | 142 | map.project_module :gantt do |map| |
|
143 | 143 | map.permission :view_gantt, :gantts => [:show, :update] |
|
144 | 144 | end |
|
145 | 145 | end |
|
146 | 146 | |
|
147 | 147 | Redmine::MenuManager.map :top_menu do |menu| |
|
148 | 148 | menu.push :home, :home_path |
|
149 | 149 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } |
|
150 | 150 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural |
|
151 | 151 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true |
|
152 | 152 | menu.push :help, Redmine::Info.help_url, :last => true |
|
153 | 153 | end |
|
154 | 154 | |
|
155 | 155 | Redmine::MenuManager.map :account_menu do |menu| |
|
156 | 156 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } |
|
157 | 157 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } |
|
158 | 158 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } |
|
159 | 159 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } |
|
160 | 160 | end |
|
161 | 161 | |
|
162 | 162 | Redmine::MenuManager.map :application_menu do |menu| |
|
163 | 163 | # Empty |
|
164 | 164 | end |
|
165 | 165 | |
|
166 | 166 | Redmine::MenuManager.map :admin_menu do |menu| |
|
167 | 167 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural |
|
168 | 168 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural |
|
169 | 169 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural |
|
170 | 170 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions |
|
171 | 171 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural |
|
172 | 172 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, |
|
173 | 173 | :html => {:class => 'issue_statuses'} |
|
174 | 174 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow |
|
175 | 175 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, |
|
176 | 176 | :html => {:class => 'custom_fields'} |
|
177 | 177 | menu.push :enumerations, {:controller => 'enumerations'} |
|
178 | 178 | menu.push :settings, {:controller => 'settings'} |
|
179 | 179 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, |
|
180 | 180 | :html => {:class => 'server_authentication'} |
|
181 | 181 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true |
|
182 | 182 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true |
|
183 | 183 | end |
|
184 | 184 | |
|
185 | 185 | Redmine::MenuManager.map :project_menu do |menu| |
|
186 | 186 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
187 | 187 | menu.push :activity, { :controller => 'activities', :action => 'index' } |
|
188 | 188 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, |
|
189 | 189 | :if => Proc.new { |p| p.shared_versions.any? } |
|
190 | 190 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
191 | 191 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, |
|
192 | 192 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } |
|
193 | 193 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt |
|
194 | 194 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar |
|
195 | 195 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
196 | 196 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
197 | 197 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
|
198 | 198 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
199 | 199 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, |
|
200 | 200 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural |
|
201 | 201 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural |
|
202 | 202 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, |
|
203 | 203 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
204 | 204 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true |
|
205 | 205 | end |
|
206 | 206 | |
|
207 | 207 | Redmine::Activity.map do |activity| |
|
208 | 208 | activity.register :issues, :class_name => %w(Issue Journal) |
|
209 | 209 | activity.register :changesets |
|
210 | 210 | activity.register :news |
|
211 | 211 | activity.register :documents, :class_name => %w(Document Attachment) |
|
212 | 212 | activity.register :files, :class_name => 'Attachment' |
|
213 | 213 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false |
|
214 | 214 | activity.register :messages, :default => false |
|
215 | 215 | activity.register :time_entries, :default => false |
|
216 | 216 | end |
|
217 | 217 | |
|
218 | 218 | Redmine::Search.map do |search| |
|
219 | 219 | search.register :issues |
|
220 | 220 | search.register :news |
|
221 | 221 | search.register :documents |
|
222 | 222 | search.register :changesets |
|
223 | 223 | search.register :wiki_pages |
|
224 | 224 | search.register :messages |
|
225 | 225 | search.register :projects |
|
226 | 226 | end |
|
227 | 227 | |
|
228 | 228 | Redmine::WikiFormatting.map do |format| |
|
229 | 229 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper |
|
230 | 230 | end |
@@ -1,189 +1,189 | |||
|
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
|
2 | 2 | |
|
3 | 3 | class ProjectEnumerationsControllerTest < ActionController::TestCase |
|
4 | 4 | fixtures :all |
|
5 | 5 | |
|
6 | 6 | def setup |
|
7 | 7 | @request.session[:user_id] = nil |
|
8 | 8 | Setting.default_language = 'en' |
|
9 | 9 | end |
|
10 | 10 | |
|
11 |
def test_ |
|
|
11 | def test_update_to_override_system_activities | |
|
12 | 12 | @request.session[:user_id] = 2 # manager |
|
13 | 13 | billable_field = TimeEntryActivityCustomField.find_by_name("Billable") |
|
14 | 14 | |
|
15 |
p |
|
|
15 | put :update, :project_id => 1, :enumerations => { | |
|
16 | 16 | "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # Design, De-activate |
|
17 | 17 | "10"=> {"parent_id"=>"10", "custom_field_values"=>{"7"=>"0"}, "active"=>"1"}, # Development, Change custom value |
|
18 | 18 | "14"=>{"parent_id"=>"14", "custom_field_values"=>{"7"=>"1"}, "active"=>"1"}, # Inactive Activity, Activate with custom value |
|
19 | 19 | "11"=>{"parent_id"=>"11", "custom_field_values"=>{"7"=>"1"}, "active"=>"1"} # QA, no changes |
|
20 | 20 | } |
|
21 | 21 | |
|
22 | 22 | assert_response :redirect |
|
23 | 23 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
24 | 24 | |
|
25 | 25 | # Created project specific activities... |
|
26 | 26 | project = Project.find('ecookbook') |
|
27 | 27 | |
|
28 | 28 | # ... Design |
|
29 | 29 | design = project.time_entry_activities.find_by_name("Design") |
|
30 | 30 | assert design, "Project activity not found" |
|
31 | 31 | |
|
32 | 32 | assert_equal 9, design.parent_id # Relate to the system activity |
|
33 | 33 | assert_not_equal design.parent.id, design.id # Different records |
|
34 | 34 | assert_equal design.parent.name, design.name # Same name |
|
35 | 35 | assert !design.active? |
|
36 | 36 | |
|
37 | 37 | # ... Development |
|
38 | 38 | development = project.time_entry_activities.find_by_name("Development") |
|
39 | 39 | assert development, "Project activity not found" |
|
40 | 40 | |
|
41 | 41 | assert_equal 10, development.parent_id # Relate to the system activity |
|
42 | 42 | assert_not_equal development.parent.id, development.id # Different records |
|
43 | 43 | assert_equal development.parent.name, development.name # Same name |
|
44 | 44 | assert development.active? |
|
45 | 45 | assert_equal "0", development.custom_value_for(billable_field).value |
|
46 | 46 | |
|
47 | 47 | # ... Inactive Activity |
|
48 | 48 | previously_inactive = project.time_entry_activities.find_by_name("Inactive Activity") |
|
49 | 49 | assert previously_inactive, "Project activity not found" |
|
50 | 50 | |
|
51 | 51 | assert_equal 14, previously_inactive.parent_id # Relate to the system activity |
|
52 | 52 | assert_not_equal previously_inactive.parent.id, previously_inactive.id # Different records |
|
53 | 53 | assert_equal previously_inactive.parent.name, previously_inactive.name # Same name |
|
54 | 54 | assert previously_inactive.active? |
|
55 | 55 | assert_equal "1", previously_inactive.custom_value_for(billable_field).value |
|
56 | 56 | |
|
57 | 57 | # ... QA |
|
58 | 58 | assert_equal nil, project.time_entry_activities.find_by_name("QA"), "Custom QA activity created when it wasn't modified" |
|
59 | 59 | end |
|
60 | 60 | |
|
61 |
def test_ |
|
|
61 | def test_update_will_update_project_specific_activities | |
|
62 | 62 | @request.session[:user_id] = 2 # manager |
|
63 | 63 | |
|
64 | 64 | project_activity = TimeEntryActivity.new({ |
|
65 | 65 | :name => 'Project Specific', |
|
66 | 66 | :parent => TimeEntryActivity.find(:first), |
|
67 | 67 | :project => Project.find(1), |
|
68 | 68 | :active => true |
|
69 | 69 | }) |
|
70 | 70 | assert project_activity.save |
|
71 | 71 | project_activity_two = TimeEntryActivity.new({ |
|
72 | 72 | :name => 'Project Specific Two', |
|
73 | 73 | :parent => TimeEntryActivity.find(:last), |
|
74 | 74 | :project => Project.find(1), |
|
75 | 75 | :active => true |
|
76 | 76 | }) |
|
77 | 77 | assert project_activity_two.save |
|
78 | 78 | |
|
79 | 79 | |
|
80 |
p |
|
|
80 | put :update, :project_id => 1, :enumerations => { | |
|
81 | 81 | project_activity.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # De-activate |
|
82 | 82 | project_activity_two.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"} # De-activate |
|
83 | 83 | } |
|
84 | 84 | |
|
85 | 85 | assert_response :redirect |
|
86 | 86 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
87 | 87 | |
|
88 | 88 | # Created project specific activities... |
|
89 | 89 | project = Project.find('ecookbook') |
|
90 | 90 | assert_equal 2, project.time_entry_activities.count |
|
91 | 91 | |
|
92 | 92 | activity_one = project.time_entry_activities.find_by_name(project_activity.name) |
|
93 | 93 | assert activity_one, "Project activity not found" |
|
94 | 94 | assert_equal project_activity.id, activity_one.id |
|
95 | 95 | assert !activity_one.active? |
|
96 | 96 | |
|
97 | 97 | activity_two = project.time_entry_activities.find_by_name(project_activity_two.name) |
|
98 | 98 | assert activity_two, "Project activity not found" |
|
99 | 99 | assert_equal project_activity_two.id, activity_two.id |
|
100 | 100 | assert !activity_two.active? |
|
101 | 101 | end |
|
102 | 102 | |
|
103 |
def test_ |
|
|
103 | def test_update_when_creating_new_activities_will_convert_existing_data | |
|
104 | 104 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size |
|
105 | 105 | |
|
106 | 106 | @request.session[:user_id] = 2 # manager |
|
107 |
p |
|
|
107 | put :update, :project_id => 1, :enumerations => { | |
|
108 | 108 | "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"} # Design, De-activate |
|
109 | 109 | } |
|
110 | 110 | assert_response :redirect |
|
111 | 111 | |
|
112 | 112 | # No more TimeEntries using the system activity |
|
113 | 113 | assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "Time Entries still assigned to system activities" |
|
114 | 114 | # All TimeEntries using project activity |
|
115 | 115 | project_specific_activity = TimeEntryActivity.find_by_parent_id_and_project_id(9, 1) |
|
116 | 116 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(project_specific_activity.id, 1).size, "No Time Entries assigned to the project activity" |
|
117 | 117 | end |
|
118 | 118 | |
|
119 |
def test_ |
|
|
119 | def test_update_when_creating_new_activities_will_not_convert_existing_data_if_an_exception_is_raised | |
|
120 | 120 | # TODO: Need to cause an exception on create but these tests |
|
121 | 121 | # aren't setup for mocking. Just create a record now so the |
|
122 | 122 | # second one is a dupicate |
|
123 | 123 | parent = TimeEntryActivity.find(9) |
|
124 | 124 | TimeEntryActivity.create!({:name => parent.name, :project_id => 1, :position => parent.position, :active => true}) |
|
125 | 125 | TimeEntry.create!({:project_id => 1, :hours => 1.0, :user => User.find(1), :issue_id => 3, :activity_id => 10, :spent_on => '2009-01-01'}) |
|
126 | 126 | |
|
127 | 127 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size |
|
128 | 128 | assert_equal 1, TimeEntry.find_all_by_activity_id_and_project_id(10, 1).size |
|
129 | 129 | |
|
130 | 130 | @request.session[:user_id] = 2 # manager |
|
131 |
p |
|
|
131 | put :update, :project_id => 1, :enumerations => { | |
|
132 | 132 | "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # Design |
|
133 | 133 | "10"=> {"parent_id"=>"10", "custom_field_values"=>{"7"=>"0"}, "active"=>"1"} # Development, Change custom value |
|
134 | 134 | } |
|
135 | 135 | assert_response :redirect |
|
136 | 136 | |
|
137 | 137 | # TimeEntries shouldn't have been reassigned on the failed record |
|
138 | 138 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "Time Entries are not assigned to system activities" |
|
139 | 139 | # TimeEntries shouldn't have been reassigned on the saved record either |
|
140 | 140 | assert_equal 1, TimeEntry.find_all_by_activity_id_and_project_id(10, 1).size, "Time Entries are not assigned to system activities" |
|
141 | 141 | end |
|
142 | 142 | |
|
143 |
|
|
|
143 | def test_destroy | |
|
144 | 144 | @request.session[:user_id] = 2 # manager |
|
145 | 145 | project_activity = TimeEntryActivity.new({ |
|
146 | 146 | :name => 'Project Specific', |
|
147 | 147 | :parent => TimeEntryActivity.find(:first), |
|
148 | 148 | :project => Project.find(1), |
|
149 | 149 | :active => true |
|
150 | 150 | }) |
|
151 | 151 | assert project_activity.save |
|
152 | 152 | project_activity_two = TimeEntryActivity.new({ |
|
153 | 153 | :name => 'Project Specific Two', |
|
154 | 154 | :parent => TimeEntryActivity.find(:last), |
|
155 | 155 | :project => Project.find(1), |
|
156 | 156 | :active => true |
|
157 | 157 | }) |
|
158 | 158 | assert project_activity_two.save |
|
159 | 159 | |
|
160 | delete :destroy, :id => 1 | |
|
160 | delete :destroy, :project_id => 1 | |
|
161 | 161 | assert_response :redirect |
|
162 | 162 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
163 | 163 | |
|
164 | 164 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) |
|
165 | 165 | assert_nil TimeEntryActivity.find_by_id(project_activity_two.id) |
|
166 | 166 | end |
|
167 | 167 | |
|
168 | 168 | def test_destroy_should_reassign_time_entries_back_to_the_system_activity |
|
169 | 169 | @request.session[:user_id] = 2 # manager |
|
170 | 170 | project_activity = TimeEntryActivity.new({ |
|
171 | 171 | :name => 'Project Specific Design', |
|
172 | 172 | :parent => TimeEntryActivity.find(9), |
|
173 | 173 | :project => Project.find(1), |
|
174 | 174 | :active => true |
|
175 | 175 | }) |
|
176 | 176 | assert project_activity.save |
|
177 | 177 | assert TimeEntry.update_all("activity_id = '#{project_activity.id}'", ["project_id = ? AND activity_id = ?", 1, 9]) |
|
178 | 178 | assert 3, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size |
|
179 | 179 | |
|
180 | delete :destroy, :id => 1 | |
|
180 | delete :destroy, :project_id => 1 | |
|
181 | 181 | assert_response :redirect |
|
182 | 182 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
183 | 183 | |
|
184 | 184 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) |
|
185 | 185 | assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size, "TimeEntries still assigned to project specific activity" |
|
186 | 186 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "TimeEntries still assigned to project specific activity" |
|
187 | 187 | end |
|
188 | 188 | |
|
189 | 189 | end |
@@ -1,290 +1,290 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require "#{File.dirname(__FILE__)}/../test_helper" |
|
19 | 19 | |
|
20 | 20 | class RoutingTest < ActionController::IntegrationTest |
|
21 | 21 | context "activities" do |
|
22 | 22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil |
|
23 | 23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | context "attachments" do |
|
27 | 27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' |
|
28 | 28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' |
|
29 | 29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' |
|
30 | 30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' |
|
31 | 31 | end |
|
32 | 32 | |
|
33 | 33 | context "boards" do |
|
34 | 34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
35 | 35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
36 | 36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' |
|
37 | 37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' |
|
38 | 38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
39 | 39 | |
|
40 | 40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
41 | 41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
42 | 42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' |
|
43 | 43 | |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | context "documents" do |
|
47 | 47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' |
|
48 | 48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
49 | 49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' |
|
50 | 50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' |
|
51 | 51 | |
|
52 | 52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
53 | 53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' |
|
54 | 54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' |
|
55 | 55 | end |
|
56 | 56 | |
|
57 | 57 | context "issues" do |
|
58 | 58 | # REST actions |
|
59 | 59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' |
|
60 | 60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' |
|
61 | 61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' |
|
62 | 62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' |
|
63 | 63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' |
|
64 | 64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' |
|
65 | 65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' |
|
66 | 66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' |
|
67 | 67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' |
|
68 | 68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' |
|
69 | 69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' |
|
70 | 70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' |
|
71 | 71 | |
|
72 | 72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' |
|
73 | 73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' |
|
74 | 74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' |
|
75 | 75 | |
|
76 | 76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
77 | 77 | # TODO: Should use PUT |
|
78 | 78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
79 | 79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' |
|
80 | 80 | |
|
81 | 81 | # TODO: Should use DELETE |
|
82 | 82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' |
|
83 | 83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' |
|
84 | 84 | |
|
85 | 85 | # Extra actions |
|
86 | 86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
87 | 87 | |
|
88 | 88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' |
|
89 | 89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' |
|
90 | 90 | |
|
91 | 91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' |
|
92 | 92 | |
|
93 | 93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
94 | 94 | should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update' |
|
95 | 95 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
96 | 96 | should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name' |
|
97 | 97 | |
|
98 | 98 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
99 | 99 | should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update' |
|
100 | 100 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
101 | 101 | should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name' |
|
102 | 102 | |
|
103 | 103 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' |
|
104 | 104 | |
|
105 | 105 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
106 | 106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
107 | 107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
108 | 108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
109 | 109 | |
|
110 | 110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' |
|
111 | 111 | |
|
112 | 112 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' |
|
113 | 113 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' |
|
114 | 114 | end |
|
115 | 115 | |
|
116 | 116 | context "issue categories" do |
|
117 | 117 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
118 | 118 | |
|
119 | 119 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
120 | 120 | end |
|
121 | 121 | |
|
122 | 122 | context "issue relations" do |
|
123 | 123 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' |
|
124 | 124 | should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' |
|
125 | 125 | end |
|
126 | 126 | |
|
127 | 127 | context "issue reports" do |
|
128 | 128 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
129 | 129 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' |
|
130 | 130 | end |
|
131 | 131 | |
|
132 | 132 | context "members" do |
|
133 | 133 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' |
|
134 | 134 | end |
|
135 | 135 | |
|
136 | 136 | context "messages" do |
|
137 | 137 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' |
|
138 | 138 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
139 | 139 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
140 | 140 | |
|
141 | 141 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
142 | 142 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
143 | 143 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' |
|
144 | 144 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' |
|
145 | 145 | end |
|
146 | 146 | |
|
147 | 147 | context "news" do |
|
148 | 148 | should_route :get, "/news", :controller => 'news', :action => 'index' |
|
149 | 149 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' |
|
150 | 150 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' |
|
151 | 151 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' |
|
152 | 152 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' |
|
153 | 153 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' |
|
154 | 154 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' |
|
155 | 155 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' |
|
156 | 156 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' |
|
157 | 157 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
158 | 158 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' |
|
159 | 159 | |
|
160 | 160 | should_route :post, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
161 | 161 | should_route :post, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
162 | 162 | should_route :post, "/news/567/destroy", :controller => 'news', :action => 'destroy', :id => '567' |
|
163 | 163 | end |
|
164 | 164 | |
|
165 | 165 | context "projects" do |
|
166 | 166 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
167 | 167 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
168 | 168 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
169 | 169 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
170 | 170 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
171 | 171 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
172 | 172 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
173 | 173 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
174 | 174 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :id => '33' |
|
175 | 175 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :id => '33' |
|
176 | 176 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
177 | 177 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
178 | 178 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
179 | 179 | |
|
180 | 180 | should_route :post, "/projects", :controller => 'projects', :action => 'create' |
|
181 | 181 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
182 | 182 | should_route :post, "/projects/33/files/new", :controller => 'files', :action => 'new', :id => '33' |
|
183 | 183 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
184 | 184 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
185 | should_route :post, "/projects/64/activities/save", :controller => 'project_enumerations', :action => 'save', :id => '64' | |
|
186 | 185 | |
|
186 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' | |
|
187 | 187 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' |
|
188 | 188 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
189 | 189 | |
|
190 | 190 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' |
|
191 | 191 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
192 |
should_route :delete, "/projects/64/ |
|
|
192 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' | |
|
193 | 193 | end |
|
194 | 194 | |
|
195 | 195 | context "repositories" do |
|
196 | 196 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
197 | 197 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
198 | 198 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
199 | 199 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
200 | 200 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
201 | 201 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
202 | 202 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
203 | 203 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
204 | 204 | should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2' |
|
205 | 205 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
206 | 206 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
207 | 207 | should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2' |
|
208 | 208 | should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw' |
|
209 | 209 | should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw' |
|
210 | 210 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
211 | 211 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
212 | 212 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
213 | 213 | |
|
214 | 214 | |
|
215 | 215 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
216 | 216 | end |
|
217 | 217 | |
|
218 | 218 | context "timelogs" do |
|
219 | 219 | should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567' |
|
220 | 220 | should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' |
|
221 | 221 | should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' |
|
222 | 222 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
223 | 223 | should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report' |
|
224 | 224 | should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567' |
|
225 | 225 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' |
|
226 | 226 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'details' |
|
227 | 227 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv' |
|
228 | 228 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom' |
|
229 | 229 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567' |
|
230 | 230 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv' |
|
231 | 231 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom' |
|
232 | 232 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234' |
|
233 | 233 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv' |
|
234 | 234 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom' |
|
235 | 235 | should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123' |
|
236 | 236 | |
|
237 | 237 | should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
238 | 238 | end |
|
239 | 239 | |
|
240 | 240 | context "users" do |
|
241 | 241 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
242 | 242 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
243 | 243 | should_route :get, "/users/new", :controller => 'users', :action => 'add' |
|
244 | 244 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
245 | 245 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
246 | 246 | |
|
247 | 247 | should_route :post, "/users/new", :controller => 'users', :action => 'add' |
|
248 | 248 | should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
249 | 249 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
250 | 250 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
251 | 251 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
252 | 252 | end |
|
253 | 253 | |
|
254 | 254 | context "versions" do |
|
255 | 255 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
256 | 256 | |
|
257 | 257 | should_route :post, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
258 | 258 | end |
|
259 | 259 | |
|
260 | 260 | context "wiki (singular, project's pages)" do |
|
261 | 261 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567' |
|
262 | 262 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala' |
|
263 | 263 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' |
|
264 | 264 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation' |
|
265 | 265 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1' |
|
266 | 266 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2' |
|
267 | 267 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' |
|
268 | 268 | should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index' |
|
269 | 269 | should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index' |
|
270 | 270 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index' |
|
271 | 271 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export' |
|
272 | 272 | |
|
273 | 273 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' |
|
274 | 274 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation' |
|
275 | 275 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' |
|
276 | 276 | should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida' |
|
277 | 277 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida' |
|
278 | 278 | end |
|
279 | 279 | |
|
280 | 280 | context "wikis (plural, admin setup)" do |
|
281 | 281 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
282 | 282 | |
|
283 | 283 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
284 | 284 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
285 | 285 | end |
|
286 | 286 | |
|
287 | 287 | context "administration panel" do |
|
288 | 288 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
289 | 289 | end |
|
290 | 290 | end |
General Comments 0
You need to be logged in to leave comments.
Login now