Project

General

Profile

Defect #8551 » issues.html.erb

Jérémy Chatard, 2011-06-15 15:22

 
1
<ul>
2
  <%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
3

    
4
<% if !@issue.nil? -%>
5
	<li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
6
	        :class => 'icon-edit', :disabled => !@can[:edit] %></li>
7
<% else %>
8
	<li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)},
9
	        :class => 'icon-edit', :disabled => !@can[:edit] %></li>
10
<% end %>
11

    
12
  <% if @allowed_statuses.present? %>
13
	<li class="folder">			
14
		<a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
15
		<ul>
16
		<% @statuses.each do |s| -%>
17
		    <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {:status_id => s}, :back_url => @back}, :method => :post,
18
		                              :selected => (@issue && s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
19
		<% end -%>
20
		</ul>
21
	</li>
22
  <% end %>
23

    
24
	<% unless @trackers.nil? %>
25
	<li class="folder">			
26
		<a href="#" class="submenu"><%= l(:field_tracker) %></a>
27
		<ul>
28
		<% @trackers.each do |t| -%>
29
		    <li><%= context_menu_link t.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'tracker_id' => t}, :back_url => @back}, :method => :post,
30
		                              :selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li>
31
		<% end -%>
32
		</ul>
33
	</li>
34
	<% end %>
35

    
36
	<li class="folder">			
37
		<a href="#" class="submenu"><%= l(:field_priority) %></a>
38
		<ul>
39
		<% @priorities.each do |p| -%>
40
		    <li><%= context_menu_link p.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'priority_id' => p}, :back_url => @back}, :method => :post,
41
		                              :selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
42
		<% end -%>
43
		</ul>
44
	</li>
45

    
46
  <% #TODO: allow editing versions when multiple projects %>
47
	<% unless @project.nil? || @project.shared_versions.open.empty? -%>
48
	<li class="folder">			
49
		<a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
50
		<ul>
51
		<% @project.shared_versions.open.sort.each do |v| -%>
52
		    <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,
53
		                              :selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
54
		<% end -%>
55
		    <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,
56
		                              :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
57
		</ul>
58
	</li>
59
	<% end %>
60
	<% if @assignables.present? -%>
61
	<li class="folder">			
62
		<a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
63
		<ul>
64
		<% @assignables.each do |u| -%>
65
		    <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,
66
		                              :selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>
67
		<% end -%>
68
		    <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,
69
		                              :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
70
		</ul>
71
	</li>
72
	<% end %>
73
	<% unless @project.nil? || @project.issue_categories.empty? -%>
74
	<li class="folder">			
75
		<a href="#" class="submenu"><%= l(:field_category) %></a>
76
		<ul>
77
		<% @project.issue_categories.each do |u| -%>
78
		    <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => u}, :back_url => @back}, :method => :post,
79
		                              :selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li>
80
		<% end -%>
81
		    <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,
82
		                              :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
83
		</ul>
84
	</li>
85
	<% end -%>
86

    
87
  <% if Issue.use_field_for_done_ratio? %>
88
	<li class="folder">
89
		<a href="#" class="submenu"><%= l(:field_done_ratio) %></a>
90
		<ul>
91
		<% (0..10).map{|x|x*10}.each do |p| -%>
92
		    <li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'done_ratio' => p}, :back_url => @back}, :method => :post,
93
		                                  :selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
94
		<% end -%>
95
		</ul>
96
	</li>
97
  <% end %>
98

    
99
<% if !@issue.nil? %>
100
	<% if @can[:log_time] -%>
101
	<li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue},
102
	        :class => 'icon-time-add' %></li>
103
	<% end %>
104
	<% if User.current.logged? %>
105
	<li><%= watcher_link(@issue, User.current) %></li>
106
	<% end %>
107
<% end %>
108

    
109
<% if @issue.present? %>
110
  <li><%= context_menu_link l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue},
111
	        :class => 'icon-duplicate', :disabled => !@can[:copy] %></li>
112
<% end %>
113
  <li><%= context_menu_link l(:button_copy), new_issue_move_path(:ids => @issues.collect(&:id), :copy_options => {:copy => 't'}),
114
	                        :class => 'icon-copy', :disabled => !@can[:move]  %></li>
115
  <li><%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)),
116
	                        :class => 'icon-move', :disabled => !@can[:move]  %></li>
117
  <li><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id), :back_url => @back},
118
                            :method => :post, :confirm => issues_destroy_confirmation_message(@issues), :class => 'icon-del', :disabled => !@can[:delete] %></li>
119

    
120
  <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
121
</ul>
(3-3/7)