<%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
<% if @issue -%>
- <%= context_menu_link l(:button_edit), edit_issue_path(@issue),
:class => 'icon icon-edit', :disabled => !@can[:edit] %>
<% else %>
- <%= context_menu_link l(:label_bulk_edit), bulk_edit_issues_path(:ids => @issue_ids),
:class => 'icon icon-edit', :disabled => !@can[:edit] %>
<% end %>
<% if @allowed_statuses.present? %>
-
<% @allowed_statuses.each do |s| -%>
-
<%= context_menu_link(
s.name,
_bulk_update_issues_path(
@issue,
:ids => @issue_ids, :issue => {:status_id => s}, :back_url => @back
),
:method => :patch,
:selected => (@issue && s == @issue.status), :disabled => !@can[:edit]
) %>
<% end -%>
<% end %>
<% if @trackers.present? %>
-
<% @trackers.each do |t| -%>
- <%= context_menu_link t.name, _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'tracker_id' => t}, :back_url => @back), :method => :patch,
:selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %>
<% end -%>
<% end %>
<% if @safe_attributes.include?('priority_id') && @priorities.present? -%>
-
<% @priorities.each do |p| -%>
- <%= context_menu_link p.name, _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'priority_id' => p}, :back_url => @back), :method => :patch,
:selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.any?(&:priority_derived?)) %>
<% end -%>
<% end %>
<% if @safe_attributes.include?('fixed_version_id') && @versions.present? -%>
-
<% @versions.sort.each do |v| -%>
- <%= context_menu_link format_version_name(v), _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'fixed_version_id' => v}, :back_url => @back), :method => :patch,
:selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:edit] %>
<% end -%>
- <%= context_menu_link l(:label_none), _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'fixed_version_id' => 'none'}, :back_url => @back), :method => :patch,
:selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:edit] %>
<% end %>
<% if @safe_attributes.include?('assigned_to_id') && @assignables.present? -%>
-
<% if @assignables.include?(User.current) %>
- <%= context_menu_link "<< #{l(:label_me)} >>", _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'assigned_to_id' => User.current}, :back_url => @back), :method => :patch,
:disabled => !@can[:edit] %>
<% end %>
<% @assignables.each do |u| -%>
- <%= context_menu_link u.name, _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'assigned_to_id' => u}, :back_url => @back), :method => :patch,
:selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:edit] %>
<% end -%>
- <%= context_menu_link l(:label_nobody), _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'assigned_to_id' => 'none'}, :back_url => @back), :method => :patch,
:selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:edit] %>
<% end %>
<% if @safe_attributes.include?('category_id') && @project && @project.issue_categories.any? -%>
-
<% @project.issue_categories.each do |u| -%>
- <%= context_menu_link u.name, _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'category_id' => u}, :back_url => @back), :method => :patch,
:selected => (@issue && u == @issue.category), :disabled => !@can[:edit] %>
<% end -%>
- <%= context_menu_link l(:label_none), _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'category_id' => 'none'}, :back_url => @back), :method => :patch,
:selected => (@issue && @issue.category.nil?), :disabled => !@can[:edit] %>
<% end -%>
<% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %>
-
<% (0..10).map{|x|x*10}.each do |p| -%>
- <%= context_menu_link "#{p}%", _bulk_update_issues_path(@issue, :ids => @issue_ids, :issue => {'done_ratio' => p}, :back_url => @back), :method => :patch,
:selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.any?(&:done_ratio_derived?)) %>
<% end -%>
<% end %>
<% @options_by_custom_field.each do |field, options| %>
-
<% options.each do |text, value| %>
- <%= bulk_update_custom_field_context_menu_link(field, text, value || text) %>
<% end %>
<% unless field.is_required? %>
- <%= bulk_update_custom_field_context_menu_link(field, l(:label_none), '__none__') %>
<% end %>
<% end %>
<% if @can[:add_watchers] %>
-
- <%= context_menu_link l(:button_add),
new_watchers_path(:object_type => 'issue', :object_id => @issue_ids),
:remote => true,
:class => 'icon icon-add' %>
<% end %>
<% if User.current.logged? %>
- <%= watcher_link(@issues, User.current) %>
<% end %>
<% unless @issue %>
- <%= context_menu_link l(:button_filter), _project_issues_path(@project, :set_filter => 1, :status_id => "*", :issue_id => @issue_ids.join(","), :c => @columns),
:class => 'icon icon-list' %>
<% end %>
<% if @issue.present? %>
<% if @can[:log_time] -%>
- <%= context_menu_link l(:button_log_time), new_issue_time_entry_path(@issue),
:class => 'icon icon-time-add' %>
<% end %>
<% if @can[:add_subtask] -%>
- <%= context_menu_link l(:button_add_subtask), url_for_new_subtask(@issue),
:class => 'icon icon-add' %>
<% end %>
- <%= copy_object_url_link(issue_url(@issue)) %>
- <%= context_menu_link l(:button_copy), project_copy_issue_path(@project, @issue),
:class => 'icon icon-copy', :disabled => !@can[:copy] %>
<% else %>
- <%= copy_object_url_link(_project_issues_url(@project, set_filter: 1, status_id: '*', issue_id: @issue_ids.join(','))) %>
- <%= context_menu_link l(:button_copy), bulk_edit_issues_path(:ids => @issue_ids, :copy => '1'),
:class => 'icon icon-copy', :disabled => !@can[:copy] %>
<% end %>
- <%= context_menu_link 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] %>
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>