summaryrefslogtreecommitdiffstats
path: root/app/helpers/issues_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-17 15:17:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-17 15:17:18 +0000
commitf89d04074e56ea64845a681b83896b0bea163363 (patch)
tree8905f78979f949be602e41d44670f189e6495204 /app/helpers/issues_helper.rb
parenta96f7053fc89d38ac4b5734e4515b4ae7550f4d1 (diff)
downloadredmine-f89d04074e56ea64845a681b83896b0bea163363.tar.gz
redmine-f89d04074e56ea64845a681b83896b0bea163363.zip
Warn about subtasks before deleting a parent issue (#6562).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5495 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/issues_helper.rb')
-rw-r--r--app/helpers/issues_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 86f11c706..078fca656 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -109,6 +109,24 @@ module IssuesHelper
s
end
+ def issues_destroy_confirmation_message(issues)
+ issues = [issues] unless issues.is_a?(Array)
+ message = l(:text_issues_destroy_confirmation)
+ descendant_count = issues.inject(0) {|memo, i| memo += (i.right - i.left - 1)/2}
+ if descendant_count > 0
+ issues.each do |issue|
+ next if issue.root?
+ issues.each do |other_issue|
+ descendant_count -= 1 if issue.is_descendant_of?(other_issue)
+ end
+ end
+ if descendant_count > 0
+ message << "\n" + l(:text_issues_destroy_descendants_confirmation, :count => descendant_count)
+ end
+ end
+ message
+ end
+
def sidebar_queries
unless @sidebar_queries
# User can see public queries and his own queries