diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index d3f63ede6a1f46aeea22f2616864cb4b07cef157..1873191c07584f45517ae4b97d19c7ada4fff54b 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -41,9 +41,11 @@ <h1><%= page_header_title %></h1> + <% if display_main_menu?(@project) %> <div id="main-menu"> <%= render_main_menu(@project) %> </div> + <% end %> </div> <%= tag('div', {:id => 'main', :class => (has_content?(:sidebar) ? '' : 'nosidebar')}, true) %> diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index 34cea79fa089ffde8a643e5209028ba0305f0d9e..4094a9c14ec4bcc94c424842f11fc7d01c922aee 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -166,6 +166,11 @@ module Redmine render_menu((project && !project.new_record?) ? :project_menu : :application_menu, project) end + def display_main_menu?(project) + menu_name = project && !project.new_record? ? :project_menu : :application_menu + Redmine::MenuManager.items(menu_name).size > 1 # 1 element is the root + end + def render_menu(menu, project=nil) links = [] menu_items_for(menu, project) do |node|