summaryrefslogtreecommitdiffstats
path: root/app/views/context_menus/issues.html.erb
blob: dc11b5fdb46ea6930d491ad765150891c450af48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<ul>
  <%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>

<% if !@issue.nil? -%>
	<li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
	        :class => 'icon-edit', :disabled => !@can[:edit] %></li>
	<li class="folder">			
		<a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
		<ul>
		<% @statuses.each do |s| -%>
		    <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'update', :id => @issue, :issue => {:status_id => s}, :back_url => @back}, :method => :put,
		                              :selected => (s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
		<% end -%>
		</ul>
	</li>
<% else %>
	<li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)},
	        :class => 'icon-edit', :disabled => !@can[:edit] %></li>
<% end %>

	<% unless @trackers.nil? %>
	<li class="folder">			
		<a href="#" class="submenu"><%= l(:field_tracker) %></a>
		<ul>
		<% @trackers.each do |t| -%>
		    <li><%= context_menu_link t.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'tracker_id' => t}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li>
		<% end -%>
		</ul>
	</li>
	<% end %>
	<li class="folder">			
		<a href="#" class="submenu"><%= l(:field_priority) %></a>
		<ul>
		<% @priorities.each do |p| -%>
		    <li><%= context_menu_link p.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'priority_id' => p}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
		<% end -%>
		</ul>
	</li>
	<% unless @project.nil? || @project.shared_versions.open.empty? -%>
	<li class="folder">			
		<a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
		<ul>
		<% @project.shared_versions.open.sort.each do |v| -%>
		    <li><%= context_menu_link format_version_name(v), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => v}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
		<% end -%>
		    <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => 'none'}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
		</ul>
	</li>
	<% end %>
	<% unless @assignables.nil? || @assignables.empty? -%>
	<li class="folder">			
		<a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
		<ul>
		<% @assignables.each do |u| -%>
		    <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => u}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>
		<% end -%>
		    <li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => 'none'}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
		</ul>
	</li>
	<% end %>
	<% unless @project.nil? || @project.issue_categories.empty? -%>
	<li class="folder">			
		<a href="#" class="submenu"><%= l(:field_category) %></a>
		<ul>
		<% @project.issue_categories.each do |u| -%>
		    <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => u}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li>
		<% end -%>
		    <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => 'none'}, :back_url => @back}, :method => :post,
		                              :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
		</ul>
	</li>
	<% end -%>
  <% if Issue.use_field_for_done_ratio? %>
	<li class="folder">
		<a href="#" class="submenu"><%= l(:field_done_ratio) %></a>
		<ul>
		<% (0..10).map{|x|x*10}.each do |p| -%>
		    <li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'done_ratio' => p}, :back_url => @back}, :method => :post,
		                                  :selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
		<% end -%>
		</ul>
	</li>
  <% end %>
<% if !@issue.nil? %>
	<% if @can[:log_time] -%>
	<li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue},
	        :class => 'icon-time-add' %></li>
	<% end %>
	<% if User.current.logged? %>
	<li><%= watcher_link(@issue, User.current) %></li>
	<% end %>
<% end %>

<% if @issue.present? %>
  <li><%= context_menu_link l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue},
	        :class => 'icon-duplicate', :disabled => !@can[:copy] %></li>
<% end %>
  <li><%= context_menu_link l(:button_copy), new_issue_move_path(:ids => @issues.collect(&:id), :copy_options => {:copy => 't'}),
	                        :class => 'icon-copy', :disabled => !@can[:move]  %></li>
  <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)},
                            :method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'icon-del', :disabled => !@can[:delete] %></li>

  <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul>