From f89d04074e56ea64845a681b83896b0bea163363 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 17 Apr 2011 15:17:18 +0000 Subject: [PATCH] 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 --- app/controllers/context_menus_controller.rb | 1 + app/helpers/issues_helper.rb | 18 ++++++++++++++++++ app/views/context_menus/issues.html.erb | 2 +- app/views/issues/_action_menu.rhtml | 2 +- config/locales/bg.yml | 1 + config/locales/bs.yml | 1 + config/locales/ca.yml | 1 + config/locales/cs.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/el.yml | 1 + config/locales/en-GB.yml | 1 + config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/eu.yml | 1 + config/locales/fa.yml | 1 + config/locales/fi.yml | 1 + config/locales/fr.yml | 3 ++- config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/hr.yml | 1 + config/locales/hu.yml | 1 + config/locales/id.yml | 1 + config/locales/it.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/lt.yml | 1 + config/locales/lv.yml | 1 + config/locales/mk.yml | 1 + config/locales/mn.yml | 1 + config/locales/nl.yml | 1 + config/locales/no.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/pt.yml | 1 + config/locales/ro.yml | 1 + config/locales/ru.yml | 1 + config/locales/sk.yml | 1 + config/locales/sl.yml | 1 + config/locales/sr-YU.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/th.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-TW.yml | 1 + config/locales/zh.yml | 1 + test/unit/helpers/issues_helper_test.rb | 19 +++++++++++++++++++ 49 files changed, 85 insertions(+), 3 deletions(-) diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index f2ff7020e..4d69f4f04 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -1,5 +1,6 @@ class ContextMenusController < ApplicationController helper :watchers + helper :issues def issues @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project) 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 diff --git a/app/views/context_menus/issues.html.erb b/app/views/context_menus/issues.html.erb index f0fa350ac..7b67c65c7 100644 --- a/app/views/context_menus/issues.html.erb +++ b/app/views/context_menus/issues.html.erb @@ -115,7 +115,7 @@
  • <%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)), :class => 'icon-move', :disabled => !@can[:move] %>
  • <%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id), :back_url => @back}, - :method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'icon-del', :disabled => !@can[:delete] %>
  • + :method => :post, :confirm => issues_destroy_confirmation_message(@issues), :class => 'icon-del', :disabled => !@can[:delete] %> <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %> diff --git a/app/views/issues/_action_menu.rhtml b/app/views/issues/_action_menu.rhtml index 67eec6c78..02357751f 100644 --- a/app/views/issues/_action_menu.rhtml +++ b/app/views/issues/_action_menu.rhtml @@ -5,5 +5,5 @@ <%= link_to_if_authorized l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-duplicate' %> <%= link_to_if_authorized l(:button_copy), {:controller => 'issue_moves', :action => 'new', :id => @issue, :copy_options => {:copy => 't'}}, :class => 'icon icon-copy' %> <%= link_to_if_authorized l(:button_move), {:controller => 'issue_moves', :action => 'new', :id => @issue}, :class => 'icon icon-move' %> -<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => (@issue.leaf? ? l(:text_are_you_sure) : l(:text_are_you_sure_with_children)), :method => :post, :class => 'icon icon-del' %> +<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => issues_destroy_confirmation_message(@issue), :method => :post, :class => 'icon icon-del' %> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 1bbf8bd36..821d59436 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -960,3 +960,4 @@ bg: permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/bs.yml b/config/locales/bs.yml index e55019e98..4948d97a9 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -973,3 +973,4 @@ bs: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/ca.yml b/config/locales/ca.yml index d73b5846b..7157e4c51 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -962,3 +962,4 @@ ca: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 19d79b70f..b80f590f2 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -963,3 +963,4 @@ cs: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/da.yml b/config/locales/da.yml index 2837d9937..cde883970 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -975,3 +975,4 @@ da: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/de.yml b/config/locales/de.yml index 4b8777b74..aae1495b8 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -976,3 +976,4 @@ de: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/el.yml b/config/locales/el.yml index 9a1011481..a65cefbc4 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -959,3 +959,4 @@ el: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index f61d7f372..7c11f7ebd 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -962,3 +962,4 @@ en-GB: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/en.yml b/config/locales/en.yml index 82c568f79..f5a3ffab1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -906,6 +906,7 @@ en: text_status_changed_by_changeset: "Applied in changeset %{value}." text_time_logged_by_changeset: "Applied in changeset %{value}." text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s)?' + text_issues_destroy_descendants_confirmation: "This will also delete %{count} subtask(s)." text_time_entries_destroy_confirmation: 'Are you sure you want to delete the selected time entr(y/ies)?' text_select_project_modules: 'Select modules to enable for this project:' text_default_administrator_account_changed: Default administrator account changed diff --git a/config/locales/es.yml b/config/locales/es.yml index 381ff8234..924adfe50 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -996,3 +996,4 @@ es: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 79028100c..b35f02edb 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -963,3 +963,4 @@ eu: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 3ac9c7207..477eebec9 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -962,3 +962,4 @@ fa: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 08714a3ff..78d43fdb1 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -980,3 +980,4 @@ fi: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 7d799af81..687ce4b2c 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -883,7 +883,8 @@ fr: text_load_default_configuration: Charger le paramétrage par défaut text_status_changed_by_changeset: "Appliqué par commit %{value}." text_time_logged_by_changeset: "Appliqué par commit %{value}" - text_issues_destroy_confirmation: 'Êtes-vous sûr de vouloir supprimer le(s) demandes(s) selectionnée(s) ?' + text_issues_destroy_confirmation: 'Êtes-vous sûr de vouloir supprimer la ou les demandes(s) selectionnée(s) ?' + text_issues_destroy_descendants_confirmation: "Cela entrainera également la suppression de %{count} sous-tâche(s)." text_select_project_modules: 'Sélectionner les modules à activer pour ce projet :' text_default_administrator_account_changed: Compte administrateur par défaut changé text_file_repository_writable: Répertoire de stockage des fichiers accessible en écriture diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 4e75255cc..95a6885fb 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -971,3 +971,4 @@ gl: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/he.yml b/config/locales/he.yml index a0416d291..0f57e3ff6 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -964,3 +964,4 @@ he: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 840a8f8a2..7dffacf13 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -966,3 +966,4 @@ hr: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 6232ce7dd..94e01d8de 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -978,3 +978,4 @@ field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/id.yml b/config/locales/id.yml index e6694b9bb..e362881f8 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -967,3 +967,4 @@ id: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/it.yml b/config/locales/it.yml index a3b724346..0b164f66b 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -960,3 +960,4 @@ it: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 1e64fff94..167d33613 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -982,3 +982,4 @@ ja: field_is_private: プライベート permission_set_issues_private: チケットをプライベートに設定 label_issues_visibility_public: プライベートチケット以外 + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 0c205da9a..342022e94 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1011,3 +1011,4 @@ ko: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/lt.yml b/config/locales/lt.yml index a832d7045..225bda260 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1019,3 +1019,4 @@ lt: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/lv.yml b/config/locales/lv.yml index 2089e715d..124a15d19 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -954,3 +954,4 @@ lv: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/mk.yml b/config/locales/mk.yml index 681689806..f9e09599b 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -959,3 +959,4 @@ mk: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/mn.yml b/config/locales/mn.yml index 7b29054cb..d79a24861 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -960,3 +960,4 @@ mn: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 2a4d63798..4243701ef 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -941,3 +941,4 @@ nl: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/no.yml b/config/locales/no.yml index 7a0a17beb..273de20a9 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -946,3 +946,4 @@ field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 734768d4a..64fc4465b 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -976,3 +976,4 @@ pl: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index e0e27b485..4b902025c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -979,3 +979,4 @@ pt-BR: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 9916bcbfb..de5a7557d 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -964,3 +964,4 @@ pt: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 37ac67301..8a9062c46 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -952,3 +952,4 @@ ro: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 3395bbef9..c56cc37b6 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1072,3 +1072,4 @@ ru: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 41fc93861..1f00bb3e4 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -954,3 +954,4 @@ sk: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 653a06065..5f8669c14 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -955,3 +955,4 @@ sl: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index 3c9f2e174..71f919a33 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -959,3 +959,4 @@ sr-YU: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 42bef34b4..b069f0e8f 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -960,3 +960,4 @@ sr: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 8be2c2367..aace0e8cb 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1000,3 +1000,4 @@ sv: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/th.yml b/config/locales/th.yml index 6b1afc7cb..8a9ddc868 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -956,3 +956,4 @@ th: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 8ba316fb3..c5646f92d 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -978,3 +978,4 @@ tr: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/uk.yml b/config/locales/uk.yml index a3c373f78..50b506430 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -955,3 +955,4 @@ uk: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 2d9f6ca52..188b3e9e4 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1010,3 +1010,4 @@ vi: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index cd6f208cc..b2220e653 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1041,3 +1041,4 @@ field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 14e0fa907..4b086265e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -973,3 +973,4 @@ zh: field_is_private: Private permission_set_issues_private: Set issues public or private label_issues_visibility_public: All non private issues + text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s). diff --git a/test/unit/helpers/issues_helper_test.rb b/test/unit/helpers/issues_helper_test.rb index dcb1aed85..7a40abe08 100644 --- a/test/unit/helpers/issues_helper_test.rb +++ b/test/unit/helpers/issues_helper_test.rb @@ -47,6 +47,25 @@ class IssuesHelperTest < HelperTestCase def test_issue_heading assert_equal "Bug #1", issue_heading(Issue.find(1)) end + + def test_issues_destroy_confirmation_message_with_one_root_issue + assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find(1)) + end + + def test_issues_destroy_confirmation_message_with_an_arrayt_of_root_issues + assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2])) + end + + def test_issues_destroy_confirmation_message_with_one_parent_issue + Issue.find(2).update_attribute :parent_issue_id, 1 + assert_equal l(:text_issues_destroy_confirmation) + "\n" + l(:text_issues_destroy_descendants_confirmation, :count => 1), + issues_destroy_confirmation_message(Issue.find(1)) + end + + def test_issues_destroy_confirmation_message_with_one_parent_issue_and_its_child + Issue.find(2).update_attribute :parent_issue_id, 1 + assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2])) + end context "IssuesHelper#show_detail" do context "with no_html" do