--- /dev/null
+class ContextMenusController < ApplicationController
+ helper :watchers
+
+ def issues
+ @issues = Issue.find_all_by_id(params[:ids], :include => :project)
+ if (@issues.size == 1)
+ @issue = @issues.first
+ @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
+ end
+ projects = @issues.collect(&:project).compact.uniq
+ @project = projects.first if projects.size == 1
+
+ @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
+ :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
+ :update => (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
+ :move => (@project && User.current.allowed_to?(:move_issues, @project)),
+ :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
+ :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
+ }
+ if @project
+ @assignables = @project.assignable_users
+ @assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
+ @trackers = @project.trackers
+ end
+
+ @priorities = IssuePriority.all.reverse
+ @statuses = IssueStatus.find(:all, :order => 'position')
+ @back = back_url
+
+ render :layout => false
+ end
+
+end
before_filter :find_issue, :only => [:show, :edit, :update]
before_filter :find_issues, :only => [:bulk_edit, :move, :perform_move, :destroy]
before_filter :find_project, :only => [:new, :create, :update_form]
- before_filter :authorize, :except => [:index, :changes, :context_menu]
+ before_filter :authorize, :except => [:index, :changes]
before_filter :find_optional_project, :only => [:index, :changes]
before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create]
format.json { head :ok }
end
end
-
- def context_menu
- @issues = Issue.find_all_by_id(params[:ids], :include => :project)
- if (@issues.size == 1)
- @issue = @issues.first
- @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
- end
- projects = @issues.collect(&:project).compact.uniq
- @project = projects.first if projects.size == 1
-
- @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
- :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
- :update => (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
- :move => (@project && User.current.allowed_to?(:move_issues, @project)),
- :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
- :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
- }
- if @project
- @assignables = @project.assignable_users
- @assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
- @trackers = @project.trackers
- end
-
- @priorities = IssuePriority.all.reverse
- @statuses = IssueStatus.find(:all, :order => 'position')
- @back = back_url
-
- render :layout => false
- end
def update_form
if params[:id].blank?
--- /dev/null
+<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>
+++ /dev/null
-<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>
<%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %>
<% end %>
-<%= context_menu :controller => 'issues', :action => 'context_menu' %>
+<%= context_menu issues_context_menu_path %>
<%= stylesheet_link_tag 'context_menu' %>
<% end %>
<div id="context-menu" style="display: none;"></div>
-<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %>
+<%= javascript_tag "new ContextMenu('#{issues_context_menu_path}')" %>
map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
# TODO: would look nicer as /issues/:id/preview
map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue'
+ map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
map.with_options :controller => 'issues' do |issues_routes|
issues_routes.with_options :conditions => {:method => :get} do |issues_views|
map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member
# Issues
map.permission :view_issues, {:projects => :roadmap,
- :issues => [:index, :changes, :show, :context_menu],
+ :issues => [:index, :changes, :show],
:auto_complete => [:issues],
+ :context_menus => [:issues],
:versions => [:show, :status_by],
:queries => :index,
:reports => [:issue_report, :issue_report_details]}
--- /dev/null
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ContextMenusControllerTest < ActionController::TestCase
+ fixtures :all
+
+ def test_context_menu_one_issue
+ @request.session[:user_id] = 2
+ get :issues, :ids => [1]
+ assert_response :success
+ assert_template 'context_menu'
+ assert_tag :tag => 'a', :content => 'Edit',
+ :attributes => { :href => '/issues/1/edit',
+ :class => 'icon-edit' }
+ assert_tag :tag => 'a', :content => 'Closed',
+ :attributes => { :href => '/issues/1/edit?issue%5Bstatus_id%5D=5',
+ :class => '' }
+ assert_tag :tag => 'a', :content => 'Immediate',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bpriority_id%5D=8',
+ :class => '' }
+ # Versions
+ assert_tag :tag => 'a', :content => '2.0',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3',
+ :class => '' }
+ assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4',
+ :class => '' }
+
+ assert_tag :tag => 'a', :content => 'Dave Lopper',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3',
+ :class => '' }
+ assert_tag :tag => 'a', :content => 'Duplicate',
+ :attributes => { :href => '/projects/ecookbook/issues/1/copy',
+ :class => 'icon-duplicate' }
+ assert_tag :tag => 'a', :content => 'Copy',
+ :attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&ids%5B%5D=1',
+ :class => 'icon-copy' }
+ assert_tag :tag => 'a', :content => 'Move',
+ :attributes => { :href => '/issues/move/new?ids%5B%5D=1',
+ :class => 'icon-move' }
+ assert_tag :tag => 'a', :content => 'Delete',
+ :attributes => { :href => '/issues/destroy?ids%5B%5D=1',
+ :class => 'icon-del' }
+ end
+
+ def test_context_menu_one_issue_by_anonymous
+ get :issues, :ids => [1]
+ assert_response :success
+ assert_template 'context_menu'
+ assert_tag :tag => 'a', :content => 'Delete',
+ :attributes => { :href => '#',
+ :class => 'icon-del disabled' }
+ end
+
+ def test_context_menu_multiple_issues_of_same_project
+ @request.session[:user_id] = 2
+ get :issues, :ids => [1, 2]
+ assert_response :success
+ assert_template 'context_menu'
+ assert_tag :tag => 'a', :content => 'Edit',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2',
+ :class => 'icon-edit' }
+ assert_tag :tag => 'a', :content => 'Immediate',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2&issue%5Bpriority_id%5D=8',
+ :class => '' }
+ assert_tag :tag => 'a', :content => 'Dave Lopper',
+ :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2&issue%5Bassigned_to_id%5D=3',
+ :class => '' }
+ assert_tag :tag => 'a', :content => 'Copy',
+ :attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&ids%5B%5D=1&ids%5B%5D=2',
+ :class => 'icon-copy' }
+ assert_tag :tag => 'a', :content => 'Move',
+ :attributes => { :href => '/issues/move/new?ids%5B%5D=1&ids%5B%5D=2',
+ :class => 'icon-move' }
+ assert_tag :tag => 'a', :content => 'Delete',
+ :attributes => { :href => '/issues/destroy?ids%5B%5D=1&ids%5B%5D=2',
+ :class => 'icon-del' }
+ end
+
+ def test_context_menu_multiple_issues_of_different_project
+ @request.session[:user_id] = 2
+ get :issues, :ids => [1, 2, 4]
+ assert_response :success
+ assert_template 'context_menu'
+ assert_tag :tag => 'a', :content => 'Delete',
+ :attributes => { :href => '#',
+ :class => 'icon-del disabled' }
+ end
+
+end
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier
end
- def test_context_menu_one_issue
- @request.session[:user_id] = 2
- get :context_menu, :ids => [1]
- assert_response :success
- assert_template 'context_menu'
- assert_tag :tag => 'a', :content => 'Edit',
- :attributes => { :href => '/issues/1/edit',
- :class => 'icon-edit' }
- assert_tag :tag => 'a', :content => 'Closed',
- :attributes => { :href => '/issues/1/edit?issue%5Bstatus_id%5D=5',
- :class => '' }
- assert_tag :tag => 'a', :content => 'Immediate',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bpriority_id%5D=8',
- :class => '' }
- # Versions
- assert_tag :tag => 'a', :content => '2.0',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3',
- :class => '' }
- assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4',
- :class => '' }
-
- assert_tag :tag => 'a', :content => 'Dave Lopper',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3',
- :class => '' }
- assert_tag :tag => 'a', :content => 'Duplicate',
- :attributes => { :href => '/projects/ecookbook/issues/1/copy',
- :class => 'icon-duplicate' }
- assert_tag :tag => 'a', :content => 'Copy',
- :attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&ids%5B%5D=1',
- :class => 'icon-copy' }
- assert_tag :tag => 'a', :content => 'Move',
- :attributes => { :href => '/issues/move/new?ids%5B%5D=1',
- :class => 'icon-move' }
- assert_tag :tag => 'a', :content => 'Delete',
- :attributes => { :href => '/issues/destroy?ids%5B%5D=1',
- :class => 'icon-del' }
- end
-
- def test_context_menu_one_issue_by_anonymous
- get :context_menu, :ids => [1]
- assert_response :success
- assert_template 'context_menu'
- assert_tag :tag => 'a', :content => 'Delete',
- :attributes => { :href => '#',
- :class => 'icon-del disabled' }
- end
-
- def test_context_menu_multiple_issues_of_same_project
- @request.session[:user_id] = 2
- get :context_menu, :ids => [1, 2]
- assert_response :success
- assert_template 'context_menu'
- assert_tag :tag => 'a', :content => 'Edit',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2',
- :class => 'icon-edit' }
- assert_tag :tag => 'a', :content => 'Immediate',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2&issue%5Bpriority_id%5D=8',
- :class => '' }
- assert_tag :tag => 'a', :content => 'Dave Lopper',
- :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2&issue%5Bassigned_to_id%5D=3',
- :class => '' }
- assert_tag :tag => 'a', :content => 'Copy',
- :attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&ids%5B%5D=1&ids%5B%5D=2',
- :class => 'icon-copy' }
- assert_tag :tag => 'a', :content => 'Move',
- :attributes => { :href => '/issues/move/new?ids%5B%5D=1&ids%5B%5D=2',
- :class => 'icon-move' }
- assert_tag :tag => 'a', :content => 'Delete',
- :attributes => { :href => '/issues/destroy?ids%5B%5D=1&ids%5B%5D=2',
- :class => 'icon-del' }
- end
-
- def test_context_menu_multiple_issues_of_different_project
- @request.session[:user_id] = 2
- get :context_menu, :ids => [1, 2, 4]
- assert_response :success
- assert_template 'context_menu'
- assert_tag :tag => 'a', :content => 'Delete',
- :attributes => { :href => '#',
- :class => 'icon-del disabled' }
- end
-
def test_destroy_issue_with_no_time_entries
assert_nil TimeEntry.find_by_issue_id(2)
@request.session[:user_id] = 2
should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
+ should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
+ should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
end
context "issue categories" do