diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index 1e37f623b..89bd243c3 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -46,6 +46,14 @@ class ContextMenusController < ApplicationController @priorities = IssuePriority.active.reverse @back = back_url + begin + # Recognize the controller and action from the back_url to determine + # which view triggered the context menu. + # @route => {:controller=>"issues", :action=>"show", :id=>"2"} + @route = Rails.application.routes.recognize_path(@back) + rescue ActionController::RoutingError + @route = {} + end @columns = params[:c] diff --git a/app/views/context_menus/issues.html.erb b/app/views/context_menus/issues.html.erb index ee7eaa18c..3e9454f5f 100644 --- a/app/views/context_menus/issues.html.erb +++ b/app/views/context_menus/issues.html.erb @@ -173,8 +173,10 @@
  • <%= context_menu_link sprite_icon('copy', l(:button_copy)), bulk_edit_issues_path(:ids => @issue_ids, :copy => '1'), :class => 'icon icon-copy', :disabled => !@can[:copy] %>
  • <% end %> -
  • <%= context_menu_link sprite_icon('del', l(:button_delete_object, object_name: (@issue_ids.size > 1 ? l(:label_issue_plural) : l(:label_issue))).capitalize), issues_path(:ids => @issue_ids, :back_url => @back), - :method => :delete, :data => {:confirm => issues_destroy_confirmation_message(@issues)}, :class => 'icon icon-del', :disabled => !@can[:delete] %>
  • + <% if @route[:controller] == 'issues' && @route[:action] == 'index' %> +
  • <%= context_menu_link sprite_icon('del', l(:button_delete_object, object_name: (@issue_ids.size > 1 ? l(:label_issue_plural) : l(:label_issue))).capitalize), issues_path(:ids => @issue_ids, :back_url => @back), + :method => :delete, :data => {:confirm => issues_destroy_confirmation_message(@issues)}, :class => 'icon icon-del', :disabled => !@can[:delete] %>
  • + <% end %> <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>