@@ -34,6 +34,12 | |||
|
34 | 34 | <%= link_to l(:label_settings), :controller => 'settings' %> |
|
35 | 35 | </p> |
|
36 | 36 | |
|
37 | <% menu_items_for(:admin_menu) do |item, caption, url, selected| -%> | |
|
38 | <%= content_tag 'p', | |
|
39 | link_to(h(caption), item.url, item.html_options), | |
|
40 | :class => ["icon22", "icon22-#{item.name}"].join(' ') %> | |
|
41 | <% end -%> | |
|
42 | ||
|
37 | 43 | <p class="icon22 icon22-info"> |
|
38 | 44 | <%= link_to l(:label_information_plural), :controller => 'admin', :action => 'info' %> |
|
39 | 45 | </p> |
@@ -124,6 +124,10 Redmine::MenuManager.map :application_menu do |menu| | |||
|
124 | 124 | # Empty |
|
125 | 125 | end |
|
126 | 126 | |
|
127 | Redmine::MenuManager.map :admin_menu do |menu| | |
|
128 | # Empty | |
|
129 | end | |
|
130 | ||
|
127 | 131 | Redmine::MenuManager.map :project_menu do |menu| |
|
128 | 132 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
129 | 133 | menu.push :activity, { :controller => 'projects', :action => 'activity' } |
@@ -70,6 +70,15 module Redmine | |||
|
70 | 70 | |
|
71 | 71 | def render_menu(menu, project=nil) |
|
72 | 72 | links = [] |
|
73 | menu_items_for(menu, project) do |item, caption, url, selected| | |
|
74 | links << content_tag('li', | |
|
75 | link_to(h(caption), url, (selected ? item.html_options.merge(:class => 'selected') : item.html_options))) | |
|
76 | end | |
|
77 | links.empty? ? nil : content_tag('ul', links.join("\n")) | |
|
78 | end | |
|
79 | ||
|
80 | def menu_items_for(menu, project=nil) | |
|
81 | items = [] | |
|
73 | 82 | Redmine::MenuManager.allowed_items(menu, User.current, project).each do |item| |
|
74 | 83 | unless item.condition && !item.condition.call(project) |
|
75 | 84 | url = case item.url |
@@ -82,11 +91,14 module Redmine | |||
|
82 | 91 | end |
|
83 | 92 | caption = item.caption(project) |
|
84 | 93 | caption = l(caption) if caption.is_a?(Symbol) |
|
85 | links << content_tag('li', | |
|
86 | link_to(h(caption), url, (current_menu_item == item.name ? item.html_options.merge(:class => 'selected') : item.html_options))) | |
|
94 | if block_given? | |
|
95 | yield item, caption, url, (current_menu_item == item.name) | |
|
96 | else | |
|
97 | items << [item, caption, url, (current_menu_item == item.name)] | |
|
87 | 98 | end |
|
88 | 99 | end |
|
89 | links.empty? ? nil : content_tag('ul', links.join("\n")) | |
|
100 | end | |
|
101 | return block_given? ? nil : items | |
|
90 | 102 | end |
|
91 | 103 | end |
|
92 | 104 |
General Comments 0
You need to be logged in to leave comments.
Login now