Merge issue context menu changes

This commit is contained in:
Eric Davis 2011-03-05 19:55:16 -08:00
parent 84ef979c47
commit ec21b4c075
2 changed files with 43 additions and 36 deletions

View File

@ -1,52 +1,59 @@
<ul> <%# Added: classes to the li %>
<%# Added: classes to the a %>
<%# Added: div for submenu icons %>
<%# Removed: icon-* on links %>
<ul class="menu">
<%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %> <%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
<% if !@issue.nil? -%> <% if !@issue.nil? -%>
<li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, <li class="edit"><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
:class => 'icon-edit', :disabled => !@can[:edit] %></li> :class => 'icon-edit', :disabled => !@can[:edit] %></li>
<% else %> <% else %>
<li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)}, <li class="edit"><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)},
:class => 'icon-edit', :disabled => !@can[:edit] %></li> :class => 'icon-edit', :disabled => !@can[:edit] %></li>
<% end %> <% end %>
<% if @allowed_statuses.present? %> <% if @allowed_statuses.present? %>
<li class="folder"> <li class="folder status">
<a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a> <a href="#" class="context_item" onclick="return false;"><%= l(:field_status) %></a>
<ul> <ul>
<% @statuses.each do |s| -%> <% @statuses.each do |s| -%>
<li><%= context_menu_link s.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {:status_id => s}, :back_url => @back}, :method => :post, <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {:status_id => s}, :back_url => @back}, :method => :post,
:selected => (@issue && s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li> :selected => (@issue && s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
<% end -%> <% end -%>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% end %> <% end %>
<% unless @trackers.nil? %> <% unless @trackers.nil? %>
<li class="folder"> <li class="folder tracker">
<a href="#" class="submenu"><%= l(:field_tracker) %></a> <a href="#" class="context_item"><%= l(:field_tracker) %></a>
<ul> <ul>
<% @trackers.each do |t| -%> <% @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, <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> :selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li>
<% end -%> <% end -%>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% end %> <% end %>
<li class="folder"> <li class="folder priority">
<a href="#" class="submenu"><%= l(:field_priority) %></a> <a href="#" class="context_item"><%= l(:field_priority) %></a>
<ul> <ul>
<% @priorities.each do |p| -%> <% @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, <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> :selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
<% end -%> <% end -%>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% #TODO: allow editing versions when multiple projects %> <% #TODO: allow editing versions when multiple projects %>
<% unless @project.nil? || @project.shared_versions.open.empty? -%> <% unless @project.nil? || @project.shared_versions.open.empty? -%>
<li class="folder"> <li class="folder fixed_version">
<a href="#" class="submenu"><%= l(:field_fixed_version) %></a> <a href="#" class="context_item"><%= l(:field_fixed_version) %></a>
<ul> <ul>
<% @project.shared_versions.open.sort.each do |v| -%> <% @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, <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,
@ -55,11 +62,13 @@
<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, <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> :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% end %> <% end %>
<% if @assignables.present? -%> <% if @assignables.present? -%>
<li class="folder"> <li class="folder assigned">
<a href="#" class="submenu"><%= l(:field_assigned_to) %></a> <a href="#" class="context_item"><%= l(:field_assigned_to) %></a>
<ul> <ul>
<% @assignables.each do |u| -%> <% @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, <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,
@ -68,11 +77,13 @@
<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, <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> :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% end %> <% end %>
<% unless @project.nil? || @project.issue_categories.empty? -%> <% unless @project.nil? || @project.issue_categories.empty? -%>
<li class="folder"> <li class="folder">
<a href="#" class="submenu"><%= l(:field_category) %></a> <a href="#" class="context_item"><%= l(:field_category) %></a>
<ul> <ul>
<% @project.issue_categories.each do |u| -%> <% @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, <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => u}, :back_url => @back}, :method => :post,
@ -81,28 +92,30 @@
<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, <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> :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% end -%> <% end -%>
<% if Issue.use_field_for_done_ratio? %> <% if Issue.use_field_for_done_ratio? %>
<li class="folder"> <li class="folder done_ratio">
<a href="#" class="submenu"><%= l(:field_done_ratio) %></a> <a href="#" class="context_item"><%= l(:field_done_ratio) %></a>
<ul> <ul>
<% (0..10).map{|x|x*10}.each do |p| -%> <% (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, <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> :selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
<% end -%> <% end -%>
</ul> </ul>
<div class="submenu"></div>
</li> </li>
<% end %> <% end %>
<% if !@issue.nil? %> <% if !@issue.nil? %>
<% if @can[:log_time] -%> <% if @can[:log_time] -%>
<li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue}, <li class="log_time"><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue},
:class => 'icon-time-add' %></li> :class => 'context_item' %></li>
<% end %> <% end %>
<% if User.current.logged? %> <% if User.current.logged? %>
<li><%= watcher_link(@issue, User.current) %></li> <li class="watch"><%= watcher_link(@issue, User.current) %></li>
<% end %> <% end %>
<% end %> <% end %>
@ -110,12 +123,14 @@
<li><%= context_menu_link l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, <li><%= context_menu_link l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue},
:class => 'icon-duplicate', :disabled => !@can[:copy] %></li> :class => 'icon-duplicate', :disabled => !@can[:copy] %></li>
<% end %> <% 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 class="move"><%= context_menu_link l(:button_move), {:controller => 'issues', :action => 'move', :ids => @issues.collect(&:id)},
<li><%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)), :class => 'context_item', :disabled => !@can[:move] %></li>
:class => 'icon-move', :disabled => !@can[:move] %></li> <%# All users can copy because the copy acton will check their permissions on the target project %>
<li><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id), :back_url => @back}, <li class="copy"><%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'bulk_copy', :project_id => @project, :ids => @issues.collect(&:id)},
:method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'icon-del', :disabled => !@can[:delete] %></li> :class => 'context_item' %></li>
<li class="delete"><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id)},
:method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'context_item', :disabled => !@can[:delete] %></li>
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %> <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul> </ul>

View File

@ -978,14 +978,6 @@ td.issue div.issue-wrap-outer {
border-bottom:1px solid #ddd !important; border-bottom:1px solid #ddd !important;
} }
#context-menu .edit a.context_item {background-image:url(../images/edit.png) !important; background-position: left center !important;}
#context-menu .status a.context_item {background-image:url(../images/tag.png) !important; background-position: left center !important;}
#context-menu .priority a.context_item {background-image:url(../images/clock.png) !important; background-position: left center !important;}
#context-menu .assigned a.context_item {background-image:url(../images/user.png) !important; background-position: left center !important;}
#context-menu .copy a.context_item {background-image:url(../images/copy.png) !important; background-position: left center !important;}
#context-menu .move a.context_item {background-image:url(../images/move.png) !important; background-position: left center !important;}
#context-menu .delete a.context_item {background-image:url(../images/delete.png) !important; background-position: left center !important;}
#context-menu li.folder div.submenu { #context-menu li.folder div.submenu {
background:url(../images/arrow-right.png) no-repeat right; background:url(../images/arrow-right.png) no-repeat right;
position: absolute; position: absolute;