comparison app/controllers/issues_controller.rb @ 22:40f7cfd4df19

* Update to SVN trunk rev 4173
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 24 Sep 2010 14:06:04 +0100
parents 1d32c0a0efbf
children 94944d00e43c
comparison
equal deleted inserted replaced
14:1d32c0a0efbf 22:40f7cfd4df19
45 include QueriesHelper 45 include QueriesHelper
46 helper :sort 46 helper :sort
47 include SortHelper 47 include SortHelper
48 include IssuesHelper 48 include IssuesHelper
49 helper :timelog 49 helper :timelog
50 helper :gantt
50 include Redmine::Export::PDF 51 include Redmine::Export::PDF
51 52
52 verify :method => [:post, :delete], 53 verify :method => [:post, :delete],
53 :only => :destroy, 54 :only => :destroy,
54 :render => { :nothing => true, :status => :method_not_allowed } 55 :render => { :nothing => true, :status => :method_not_allowed }
131 render_attachment_warning_if_needed(@issue) 132 render_attachment_warning_if_needed(@issue)
132 flash[:notice] = l(:notice_successful_create) 133 flash[:notice] = l(:notice_successful_create)
133 call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) 134 call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
134 respond_to do |format| 135 respond_to do |format|
135 format.html { 136 format.html {
136 redirect_to(params[:continue] ? { :action => 'new', :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } : 137 redirect_to(params[:continue] ? { :action => 'new', :project_id => @project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } :
137 { :action => 'show', :id => @issue }) 138 { :action => 'show', :id => @issue })
138 } 139 }
139 format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'issues', :action => 'show', :id => @issue) } 140 format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'issues', :action => 'show', :id => @issue) }
140 format.json { render :text => @issue.to_json, :status => :created, :location => url_for(:controller => 'issues', :action => 'show'), :layout => false } 141 format.json { render :text => @issue.to_json, :status => :created, :location => url_for(:controller => 'issues', :action => 'show'), :layout => false }
141 end 142 end
268 @allowed_statuses = @issue.new_statuses_allowed_to(User.current) 269 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
269 @priorities = IssuePriority.all 270 @priorities = IssuePriority.all
270 @edit_allowed = User.current.allowed_to?(:edit_issues, @project) 271 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
271 @time_entry = TimeEntry.new 272 @time_entry = TimeEntry.new
272 273
273 @notes = params[:notes] 274 @notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil)
274 @issue.init_journal(User.current, @notes) 275 @issue.init_journal(User.current, @notes)
275 # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed 276 # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
276 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue] 277 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
277 attrs = params[:issue].dup 278 attrs = params[:issue].dup
278 attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed 279 attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed