Patch #2031 ยป pluggable-admin-menu.patch
| app/views/admin/index.rhtml | ||
|---|---|---|
|
<%= link_to l(:label_information_plural), :controller => 'admin', :action => 'info' %>
|
||
|
</p>
|
||
|
<% menu_items_for(:admin) do |item, caption, url, selected| -%>
|
||
|
<%= content_tag 'p',
|
||
|
link_to(h(caption), item.url, item.html_options),
|
||
|
:class => ["icon22", "icon22-#{item.name}"].join(' ') %>
|
||
|
<% end -%>
|
||
|
<% html_title(l(:label_administration)) -%>
|
||
| lib/redmine/menu_manager.rb | ||
|---|---|---|
|
|
||
|
def render_menu(menu, project=nil)
|
||
|
links = []
|
||
|
menu_items_for(menu, project) do |item, caption, url, selected|
|
||
|
links << content_tag('li',
|
||
|
link_to(h(caption), url, (selected ? item.html_options.merge(:class => 'selected') : item.html_options)))
|
||
|
end
|
||
|
links.empty? ? nil : content_tag('ul', links.join("\n"))
|
||
|
end
|
||
|
def menu_items_for(menu, project=nil)
|
||
|
items = []
|
||
|
Redmine::MenuManager.allowed_items(menu, User.current, project).each do |item|
|
||
|
unless item.condition && !item.condition.call(project)
|
||
|
url = case item.url
|
||
| ... | ... | |
|
end
|
||
|
caption = item.caption(project)
|
||
|
caption = l(caption) if caption.is_a?(Symbol)
|
||
|
links << content_tag('li',
|
||
|
link_to(h(caption), url, (current_menu_item == item.name ? item.html_options.merge(:class => 'selected') : item.html_options)))
|
||
|
if block_given?
|
||
|
yield item, caption, url, (current_menu_item == item.name)
|
||
|
else
|
||
|
items << [item, caption, url, (current_menu_item == item.name)]
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
links.empty? ? nil : content_tag('ul', links.join("\n"))
|
||
|
return block_given? ? nil : items
|
||
|
end
|
||
|
end
|
||
|
|
||