summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-29 15:10:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-29 15:10:59 +0000
commit30d65829b859c934c266b0862b30aa4b57d11677 (patch)
tree826b6103151bd967edfae19b131acfad75e866a8 /app
parent749d703881c6f0c44db6724d7606189aaf69eb6a (diff)
downloadredmine-30d65829b859c934c266b0862b30aa4b57d11677.tar.gz
redmine-30d65829b859c934c266b0862b30aa4b57d11677.zip
Configurable behavour for linking issues on copy (#18500).
git-svn-id: http://svn.redmine.org/redmine/trunk@13668 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issues_controller.rb17
-rw-r--r--app/helpers/settings_helper.rb10
-rw-r--r--app/views/issues/bulk_edit.html.erb8
-rw-r--r--app/views/issues/new.html.erb6
-rw-r--r--app/views/settings/_issues.html.erb2
5 files changed, 41 insertions, 2 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 78f7c27ea..ff04d0504 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -273,7 +273,8 @@ class IssuesController < ApplicationController
if @copy
issue = orig_issue.copy({},
:attachments => params[:copy_attachments].present?,
- :subtasks => params[:copy_subtasks].present?
+ :subtasks => params[:copy_subtasks].present?,
+ :link => link_copy?(params[:link_copy])
)
else
issue = orig_issue
@@ -410,9 +411,10 @@ class IssuesController < ApplicationController
if params[:copy_from]
begin
@copy_from = Issue.visible.find(params[:copy_from])
+ @link_copy = link_copy?(params[:link_copy]) || request.get?
@copy_attachments = params[:copy_attachments].present? || request.get?
@copy_subtasks = params[:copy_subtasks].present? || request.get?
- @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks)
+ @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :link => @link_copy)
rescue ActiveRecord::RecordNotFound
render_404
return
@@ -486,4 +488,15 @@ class IssuesController < ApplicationController
end
end
end
+
+ def link_copy?(param)
+ case Setting.link_copied_issue
+ when 'yes'
+ true
+ when 'no'
+ false
+ when 'ask'
+ param == '1'
+ end
+ end
end
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 3e672b951..3183a2b13 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -104,6 +104,16 @@ module SettingsHelper
content_tag(:label, tag + text, options)
end
+ def link_copied_issue_options
+ options = [
+ [:general_text_Yes, 'yes'],
+ [:general_text_No, 'no'],
+ [:label_ask, 'ask']
+ ]
+
+ options.map {|label, value| [l(label), value.to_s]}
+ end
+
def cross_project_subtasks_options
options = [
[:label_disabled, ''],
diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb
index dfd76371e..c16f48cbc 100644
--- a/app/views/issues/bulk_edit.html.erb
+++ b/app/views/issues/bulk_edit.html.erb
@@ -97,6 +97,14 @@
</p>
<% end %>
+<% if @copy && Setting.link_copied_issue == 'ask' %>
+<p>
+ <label for='link_copy'><%= l(:label_link_copied_issue) %></label>
+ <%= hidden_field_tag 'link_copy', '0' %>
+ <%= check_box_tag 'link_copy', '1', params[:link_copy] != 0 %>
+</p>
+<% end %>
+
<% if @copy && @attachments_present %>
<%= hidden_field_tag 'copy_attachments', '0' %>
<p>
diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb
index 40dae18b2..206df8d18 100644
--- a/app/views/issues/new.html.erb
+++ b/app/views/issues/new.html.erb
@@ -11,6 +11,12 @@
<%= render :partial => 'issues/form', :locals => {:f => f} %>
</div>
+ <% if @copy_from && Setting.link_copied_issue == 'ask' %>
+ <p>
+ <label for="link_copy"><%= l(:label_link_copied_issue) %></label>
+ <%= check_box_tag 'link_copy', '1', @link_copy %>
+ </p>
+ <% end %>
<% if @copy_from && @copy_from.attachments.any? %>
<p>
<label for="copy_attachments"><%= l(:label_copy_attachments) %></label>
diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb
index fac6d6dea..c1e802238 100644
--- a/app/views/settings/_issues.html.erb
+++ b/app/views/settings/_issues.html.erb
@@ -3,6 +3,8 @@
<div class="box tabular settings">
<p><%= setting_check_box :cross_project_issue_relations %></p>
+<p><%= setting_select :link_copied_issue, link_copied_issue_options %></p>
+
<p><%= setting_select :cross_project_subtasks, cross_project_subtasks_options %></p>
<p><%= setting_check_box :issue_group_assignment %></p>