Hide menu item in the cross-project menu if the module is not enabled in any project (#30207).

Patch by Yuichi HARADA.


git-svn-id: http://svn.redmine.org/redmine/trunk@17794 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2019-01-13 03:23:18 +00:00
parent 658df294dd
commit 1d3e2006b1
2 changed files with 31 additions and 5 deletions

View File

@@ -207,17 +207,17 @@ Redmine::MenuManager.map :application_menu do |menu|
:caption => :label_project_plural
menu.push :activity, {:controller => 'activities', :action => 'index'}
menu.push :issues, {:controller => 'issues', :action => 'index'},
:if => Proc.new {User.current.allowed_to?(:view_issues, nil, :global => true)},
:if => Proc.new {User.current.allowed_to?(:view_issues, nil, :global => true) && EnabledModule.exists?(:project => Project.visible, :name => :issue_tracking)},
:caption => :label_issue_plural
menu.push :time_entries, {:controller => 'timelog', :action => 'index'},
:if => Proc.new {User.current.allowed_to?(:view_time_entries, nil, :global => true)},
:if => Proc.new {User.current.allowed_to?(:view_time_entries, nil, :global => true) && EnabledModule.exists?(:project => Project.visible, :name => :time_tracking)},
:caption => :label_spent_time
menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :caption => :label_gantt,
:if => Proc.new {User.current.allowed_to?(:view_gantt, nil, :global => true)}
:if => Proc.new {User.current.allowed_to?(:view_gantt, nil, :global => true) && EnabledModule.exists?(:project => Project.visible, :name => :gantt)}
menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :caption => :label_calendar,
:if => Proc.new {User.current.allowed_to?(:view_calendar, nil, :global => true)}
:if => Proc.new {User.current.allowed_to?(:view_calendar, nil, :global => true) && EnabledModule.exists?(:project => Project.visible, :name => :calendar)}
menu.push :news, {:controller => 'news', :action => 'index'},
:if => Proc.new {User.current.allowed_to?(:view_news, nil, :global => true)},
:if => Proc.new {User.current.allowed_to?(:view_news, nil, :global => true) && EnabledModule.exists?(:project => Project.visible, :name => :news)},
:caption => :label_news_plural
end