Project

General

Profile

Feature #4403 » ro4403-copy_improvements.patch

Patch created against trunk @ r7630. - Mischa The Evil, 2011-10-20 22:26

View differences:

app/models/issue_relation.rb (working copy)
TYPE_BLOCKED = "blocked"
TYPE_PRECEDES = "precedes"
TYPE_FOLLOWS = "follows"
TYPE_COPIES = "copied to"
TYPE_COPIED = "copied from"
TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1, :sym => TYPE_RELATES },
TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2, :sym => TYPE_DUPLICATED },
......
TYPE_BLOCKS => { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 4, :sym => TYPE_BLOCKED },
TYPE_BLOCKED => { :name => :label_blocked_by, :sym_name => :label_blocks, :order => 5, :sym => TYPE_BLOCKS, :reverse => TYPE_BLOCKS },
TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 6, :sym => TYPE_FOLLOWS },
TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES }
TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES },
TYPE_COPIES => { :name => :label_copied_to, :sym_name => :label_copied_from, :order => 8, :sym => TYPE_COPIED },
TYPE_COPIED => { :name => :label_copied_from, :sym_name => :label_copied_to, :order => 9, :sym => TYPE_COPIES, :reverse => TYPE_COPIES }
}.freeze
validates_presence_of :issue_from, :issue_to, :relation_type
app/models/issue.rb (working copy)
end
end
end
if options[:relation_type]
relation = IssueRelation.new(
:relation_type => options[:relation_type],
:issue_from => self,
:issue_to => issue)
unless relation.save
issue.destroy
return false
end
end
else
return false
end
app/controllers/issue_moves_controller.rb (working copy)
before_filter :find_issues, :check_project_uniqueness
before_filter :authorize
helper :issue_relations
include IssueRelationsHelper
def new
prepare_for_issue_move
render :layout => false if request.xhr?
......
if request.post?
new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
relation_type = params[:relation_type].blank? ? nil : params[:relation_type]
unsaved_issue_ids = []
moved_issues = []
@issues.each do |issue|
......
issue.init_journal(User.current)
issue.current_journal.notes = @notes if @notes.present?
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)})
if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :relation_type => relation_type, :attributes => extract_changed_attributes_for_move(params)})
moved_issues << r
else
unsaved_issue_ids << issue.id
app/views/issue_moves/new.html.erb (working copy)
:update => 'content',
:with => "Form.serialize('move_form')") %></p>
<% if @copy && (@project == @target_project || Setting.cross_project_issue_relations?) %>
<p>
<label for="relation_type"><%= l(:label_relation_new) %></label>
<%= select_tag('relation_type', content_tag('option', l(:label_none), :value => '') +
options_for_select(collection_for_relation_type_select)) %>
</p>
<% end %>
<p><label for="new_tracker_id"><%=l(:field_tracker)%>:</label>
<%= select_tag "new_tracker_id", "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@trackers, "id", "name") %></p>
config/locales/en.yml (working copy)
label_blocked_by: blocked by
label_precedes: precedes
label_follows: follows
label_copied_to: copied to
label_copied_from: copied from
label_end_to_start: end to start
label_end_to_end: end to end
label_start_to_start: start to start
(4-4/5)