Module: Redmine::MenuManager::MenuHelper
- Defined in:
- lib/redmine/menu_manager.rb
Instance Method Summary (collapse)
-
- (Object) current_menu_item
Returns the current menu item name.
- - (Object) menu_items_for(menu, project = nil)
-
- (Object) render_main_menu(project)
Renders the application main menu.
- - (Object) render_menu(menu, project = nil)
Instance Method Details
- (Object) current_menu_item
Returns the current menu item name
71 72 73 |
# File 'lib/redmine/menu_manager.rb', line 71 def @controller. end |
- (Object) menu_items_for(menu, project = nil)
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/redmine/menu_manager.rb', line 89 def (, project=nil) items = [] Redmine::MenuManager.allowed_items(, User.current, project).each do |item| unless item.condition && !item.condition.call(project) url = case item.url when Hash project.nil? ? item.url : {item.param => project}.merge(item.url) when Symbol send(item.url) else item.url end caption = item.caption(project) if block_given? yield item, caption, url, ( == item.name) else items << [item, caption, url, ( == item.name)] end end end return block_given? ? nil : items end |
- (Object) render_main_menu(project)
Renders the application main menu
76 77 78 |
# File 'lib/redmine/menu_manager.rb', line 76 def (project) ((project && !project.new_record?) ? :project_menu : :application_menu, project) end |
- (Object) render_menu(menu, project = nil)
80 81 82 83 84 85 86 87 |
# File 'lib/redmine/menu_manager.rb', line 80 def (, project=nil) links = [] (, project) do |item, caption, url, selected| links << content_tag('li', link_to(h(caption), url, item.(:selected => selected))) end links.empty? ? nil : content_tag('ul', links.join("\n")) end |