##// END OF EJS Templates
Refactor: Replace @journal with @issue.current_journal...
Eric Davis -
r3426:c58dc83e74f2
parent child
Show More
@@ -188,6 +188,8 class IssuesController < ApplicationController
188 188 def edit
189 189 update_issue_from_params
190 190
191 @journal = @issue.current_journal
192
191 193 respond_to do |format|
192 194 format.html { }
193 195 format.xml { }
@@ -203,6 +205,7 class IssuesController < ApplicationController
203 205 format.xml { head :ok }
204 206 end
205 207 else
208 @journal = @issue.current_journal
206 209 respond_to do |format|
207 210 format.html { render :action => 'edit' }
208 211 format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
@@ -549,7 +552,7 private
549 552 @time_entry = TimeEntry.new
550 553
551 554 @notes = params[:notes]
552 @journal = @issue.init_journal(User.current, @notes)
555 @issue.init_journal(User.current, @notes)
553 556 # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
554 557 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
555 558 attrs = params[:issue].dup
@@ -573,14 +576,14 private
573 576 attachments = Attachment.attach_files(@issue, params[:attachments])
574 577 render_attachment_warning_if_needed(@issue)
575 578
576 attachments[:files].each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
577 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
579 attachments[:files].each {|a| @issue.current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
580 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @issue.current_journal})
578 581 if @issue.save
579 if !@journal.new_record?
582 if !@issue.current_journal.new_record?
580 583 # Only send notification if something was actually changed
581 584 flash[:notice] = l(:notice_successful_update)
582 585 end
583 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
586 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @issue.current_journal})
584 587 return true
585 588 end
586 589 end
@@ -48,6 +48,8 class Issue < ActiveRecord::Base
48 48
49 49 DONE_RATIO_OPTIONS = %w(issue_field issue_status)
50 50
51 attr_reader :current_journal
52
51 53 validates_presence_of :subject, :priority, :project, :tracker, :author, :status
52 54 validates_length_of :subject, :maximum => 255
53 55 validates_inclusion_of :done_ratio, :in => 0..100
General Comments 0
You need to be logged in to leave comments. Login now