From cb0161dc0e630dc7838a506d2ce66a4910decca6 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sat, 30 May 2020 08:58:26 +0000 Subject: [PATCH] Show Roadmap tab when subprojects have defined versions (#7956). Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19801 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine.rb | 2 +- .../integration/lib/redmine/menu_manager_test.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/redmine.rb b/lib/redmine.rb index beaebaec8..668a65da2 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -303,7 +303,7 @@ Redmine::MenuManager.map :project_menu do |menu| menu.push :overview, { :controller => 'projects', :action => 'show' } menu.push :activity, { :controller => 'activities', :action => 'index' } menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, - :if => Proc.new { |p| p.shared_versions.any? } + :if => Proc.new { |p| Setting.display_subprojects_issues? ? p.rolled_up_versions.any? : 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) }, diff --git a/test/integration/lib/redmine/menu_manager_test.rb b/test/integration/lib/redmine/menu_manager_test.rb index c470f438e..6fc49b64a 100644 --- a/test/integration/lib/redmine/menu_manager_test.rb +++ b/test/integration/lib/redmine/menu_manager_test.rb @@ -112,4 +112,20 @@ class MenuManagerTest < Redmine::IntegrationTest assert_select 'a.project', :count => 4 end end + + def test_project_menu_should_show_roadmap_if_subprojects_have_versions + Version.delete_all + # Create a version in the project "eCookbook Subproject 1" + version = Version.generate!(project_id: 3) + + with_settings :display_subprojects_issues => '1' do + get '/projects/ecookbook' + assert_select '#main-menu a.roadmap' + end + + with_settings :display_subprojects_issues => '0' do + get '/projects/ecookbook' + assert_select '#main-menu a.roadmap', 0 + end + end end -- 2.39.5