Tíquete #35331

hide top menu item if all menus are hidden

: 2015-07-19 17:04 Última Atualização: 2015-07-19 17:04

Relator:
Dono:
(Nenhum)
Tipo:
Estado:
Aberto
Componente:
(Nenhum)
Marcos:
(Nenhum)
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Nenhum
Arquivo:
Nenhum

Details

Index: init.rb

--- init.rb (revision 57) +++ init.rb (working copy) @@ -16,10 +16,13 @@

:partial => 'settings/info_settings')
menu(:top_menu, :redmine_info,
{ :controller => 'info', :action => 'index'},

- :if => Proc.new { User.current.logged? }) + :if => Proc.new { User.current.logged? && InfoCategory.show_top_menu? })

end

+ActionDispatch::Callbacks.to_prepare do + require_dependency 'info_category' +end

Redmine::MenuManager.map :redmine_info_menu do |menu|
InfoCategory.push_menu(menu, :permissions, :html => {:class => 'roles'})

Index: lib/info_category.rb

--- lib/info_category.rb (revision 57) +++ lib/info_category.rb (working copy) @@ -22,8 +22,7 @@

('label_' + sym.to_s).to_sym
end
end

- - +

def self.hide_map
map = {} InfoCategory.categories.each {|catsym|

@@ -32,6 +31,15 @@

map
end

+ def self.show_top_menu? + InfoCategory.categories.each {|catsym| + if (InfoCategory::is_shown?(catsym) or User.current.admin?) + return true + end + } + return false + end +

def self.push_menu(menu, catsym, opts = {})
url = {:controller => :info, :action => :show}

Ticket History (1/1 Histories)

2015-07-19 17:04 Updated by: giray_pultar
  • New Ticket "hide top menu item if all menus are hidden" created

Attachment File List

No attachments

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login