From 7c1445f19a6030bc6c23f6463411fe0e6c607f41 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 5 Dec 2014 12:17:20 +0000 Subject: [PATCH] Tab "New Issue" should not be displayed if a project has no trackers (#18571). git-svn-id: http://svn.redmine.org/redmine/trunk@13713 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine.rb | 3 ++- test/functional/projects_controller_test.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/redmine.rb b/lib/redmine.rb index bf7732352..f8f70d3d4 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -230,7 +230,8 @@ Redmine::MenuManager.map :project_menu do |menu| :if => Proc.new { |p| p.shared_versions.any? } menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new, - :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } + :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, + :if => Proc.new { |p| p.trackers.any? } menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 83fcf160e..abf862e2e 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -629,4 +629,18 @@ class ProjectsControllerTest < ActionController::TestCase get :show, :id => 1 assert_select 'body.project-ecookbook' end + + def test_project_menu_should_include_new_issue_link + @request.session[:user_id] = 2 + get :show, :id => 1 + assert_select '#main-menu a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue' + end + + def test_project_menu_should_not_include_new_issue_link_for_project_without_trackers + Project.find(1).trackers.clear + + @request.session[:user_id] = 2 + get :show, :id => 1 + assert_select '#main-menu a.new-issue', 0 + end end -- 2.39.5