Skip to content

Commit

Permalink
Hide the main menu div if there isn't any items for it. #3259
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3539 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information
edavis10 committed Mar 4, 2010
1 parent afdcd77 commit 7514e12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/views/layouts/base.rhtml
Expand Up @@ -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) %>
Expand Down
5 changes: 5 additions & 0 deletions lib/redmine/menu_manager.rb
Expand Up @@ -166,6 +166,11 @@ def render_main_menu(project)
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|
Expand Down

0 comments on commit 7514e12

Please sign in to comment.