]> source.dussan.org Git - redmine.git/commitdiff
Hide the main menu div if there isn't any items for it. #3259
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 4 Mar 2010 06:01:05 +0000 (06:01 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 4 Mar 2010 06:01:05 +0000 (06:01 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3539 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/layouts/base.rhtml
lib/redmine/menu_manager.rb

index d3f63ede6a1f46aeea22f2616864cb4b07cef157..1873191c07584f45517ae4b97d19c7ada4fff54b 100644 (file)
     
     <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) %>
index 34cea79fa089ffde8a643e5209028ba0305f0d9e..4094a9c14ec4bcc94c424842f11fc7d01c922aee 100644 (file)
@@ -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|