Project

General

Profile

Feature #35616 » 35616-WIP.patch

Go MAEDA, 2025-08-24 11:15

View differences:

app/controllers/context_menus_controller.rb
46 46

  
47 47
    @priorities = IssuePriority.active.reverse
48 48
    @back = back_url
49
    begin
50
      # Recognize the controller and action from the back_url to determine
51
      # which view triggered the context menu.
52
      # @route => {:controller=>"issues", :action=>"show", :id=>"2"}
53
      @route = Rails.application.routes.recognize_path(@back)
54
    rescue ActionController::RoutingError
55
      @route = {}
56
    end
49 57

  
50 58
    @columns = params[:c]
51 59

  
app/views/context_menus/issues.html.erb
173 173
  <li><%= context_menu_link sprite_icon('copy', l(:button_copy)), bulk_edit_issues_path(:ids => @issue_ids, :copy => '1'),
174 174
                            :class => 'icon icon-copy', :disabled => !@can[:copy] %></li>
175 175
<% end %>
176
  <li><%= 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),
177
                            :method => :delete, :data => {:confirm => issues_destroy_confirmation_message(@issues)}, :class => 'icon icon-del', :disabled => !@can[:delete] %></li>
176
  <% if @route[:controller] == 'issues' && @route[:action] == 'index' %>
177
    <li><%= 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),
178
                              :method => :delete, :data => {:confirm => issues_destroy_confirmation_message(@issues)}, :class => 'icon icon-del', :disabled => !@can[:delete] %></li>
179
  <% end %>
178 180

  
179 181
  <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
180 182
</ul>
(2-2/5)