From: Jean-Philippe Lang Date: Sun, 8 Jul 2012 13:31:22 +0000 (+0000) Subject: Compute issue ids array only once. X-Git-Tag: 2.1.0~354 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e74d4ecf5fa73690c91188a70425cc2d4640ecd9;p=redmine.git Compute issue ids array only once. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9962 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index 329c0d0c1..98b232323 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -24,6 +24,7 @@ class ContextMenusController < ApplicationController if (@issues.size == 1) @issue = @issues.first end + @issue_ids = @issues.map(&:id).sort @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&) @projects = @issues.collect(&:project).compact.uniq diff --git a/app/helpers/context_menus_helper.rb b/app/helpers/context_menus_helper.rb index f2575c913..15e670c78 100644 --- a/app/helpers/context_menus_helper.rb +++ b/app/helpers/context_menus_helper.rb @@ -36,7 +36,7 @@ module ContextMenusHelper def bulk_update_custom_field_context_menu_link(field, text, value) context_menu_link h(text), - {:controller => 'issues', :action => 'bulk_update', :ids => @issues.collect(&:id), :issue => {'custom_field_values' => {field.id => value}}, :back_url => @back}, + {:controller => 'issues', :action => 'bulk_update', :ids => @issue_ids, :issue => {'custom_field_values' => {field.id => value}}, :back_url => @back}, :method => :post, :selected => (@issue && @issue.custom_field_value(field) == value) end diff --git a/app/views/context_menus/issues.html.erb b/app/views/context_menus/issues.html.erb index f029ca408..c81e518ec 100644 --- a/app/views/context_menus/issues.html.erb +++ b/app/views/context_menus/issues.html.erb @@ -5,7 +5,7 @@
  • <%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon-edit', :disabled => !@can[:edit] %>
  • <% else %> -
  • <%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)}, +
  • <%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issue_ids}, :class => 'icon-edit', :disabled => !@can[:edit] %>
  • <% end %> @@ -14,7 +14,7 @@ <%= l(:field_status) %> @@ -26,7 +26,7 @@ <%= l(:field_tracker) %> @@ -38,7 +38,7 @@ <%= l(:field_priority) %> @@ -50,10 +50,10 @@ <%= l(:field_fixed_version) %> @@ -64,14 +64,14 @@ <%= l(:field_assigned_to) %> @@ -82,10 +82,10 @@ <%= l(:field_category) %> @@ -96,7 +96,7 @@ <%= l(:field_done_ratio) %> @@ -131,10 +131,10 @@
  • <%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, :class => 'icon-copy', :disabled => !@can[:copy] %>
  • <% else %> -
  • <%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :copy => '1'}, +
  • <%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'bulk_edit', :ids => @issue_ids, :copy => '1'}, :class => 'icon-copy', :disabled => !@can[:move] %>
  • <% end %> -
  • <%= context_menu_link l(:button_delete), issues_path(:ids => @issues.collect(&:id), :back_url => @back), +
  • <%= context_menu_link l(:button_delete), issues_path(:ids => @issue_ids, :back_url => @back), :method => :delete, :data => {: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 }) %>