class ContextMenusController < ApplicationController
helper :watchers
+ helper :issues
def issues
@issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
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
<li><%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)),
:class => 'icon-move', :disabled => !@can[:move] %></li>
<li><%= 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] %></li>
+ :method => :post, :confirm => issues_destroy_confirmation_message(@issues), :class => 'icon-del', :disabled => !@can[:delete] %></li>
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul>
<%= 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' %>
</div>
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).
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).
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).
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).
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).
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).
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).
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).
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
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).
field_is_private: Private\r
permission_set_issues_private: Set issues public or private\r
label_issues_visibility_public: All non private issues\r
+ text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s).\r
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).
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).
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
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).
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).
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).
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).
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).
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).
field_is_private: プライベート
permission_set_issues_private: チケットをプライベートに設定
label_issues_visibility_public: プライベートチケット以外
+ text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s).
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).
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).
field_is_private: Private\r
permission_set_issues_private: Set issues public or private\r
label_issues_visibility_public: All non private issues\r
+ text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s).\r
field_is_private: Private\r
permission_set_issues_private: Set issues public or private\r
label_issues_visibility_public: All non private issues\r
+ text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s).\r
field_is_private: Private\r
permission_set_issues_private: Set issues public or private\r
label_issues_visibility_public: All non private issues\r
+ text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s).\r
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).
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).
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).
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).
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).
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).
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).
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).
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).
field_is_private: Private\r
permission_set_issues_private: Set issues public or private\r
label_issues_visibility_public: All non private issues\r
+ text_issues_destroy_descendants_confirmation: This will also delete %{count} subtask(s).\r
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).
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).
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).
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).
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).
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).
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).
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).
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