Adds a <<me>> option for assignee in the context menu (#1102).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8689 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-01-21 11:11:13 +00:00
parent 45e3dafa8f
commit f2a7f83c82
2 changed files with 15 additions and 0 deletions

View File

@ -61,6 +61,10 @@
<li class="folder">
<a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
<ul>
<% if @assignables.include?(User.current) %>
<li><%= context_menu_link "<< #{l(:label_me)} >>", {:controller => 'issues', :action => 'bulk_update', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => User.current}, :back_url => @back}, :method => :post,
:disabled => !@can[:update] %></li>
<% end %>
<% @assignables.each do |u| -%>
<li><%= context_menu_link h(u.name), {:controller => 'issues', :action => 'bulk_update', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => u}, :back_url => @back}, :method => :post,
:selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>

View File

@ -117,6 +117,17 @@ class ContextMenusControllerTest < ActionController::TestCase
:class => 'icon-del' }
end
def test_context_menu_by_assignable_user_should_include_assigned_to_me_link
@request.session[:user_id] = 2
get :issues, :ids => [1]
assert_response :success
assert_template 'context_menu'
assert_tag :tag => 'a', :content => / me /,
:attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=2',
:class => '' }
end
def test_context_menu_issue_visibility
get :issues, :ids => [1, 4]
assert_response :success