hide top menu item if all menus are hidden
Index: init.rb
--- init.rb (revision 57) +++ init.rb (working copy) @@ -16,10 +16,13 @@
- :if => Proc.new { User.current.logged? }) + :if => Proc.new { User.current.logged? && InfoCategory.show_top_menu? })
+ActionDispatch::Callbacks.to_prepare do + require_dependency 'info_category' +end
Index: lib/info_category.rb
--- lib/info_category.rb (revision 57) +++ lib/info_category.rb (working copy) @@ -22,8 +22,7 @@
- - +
@@ -32,6 +31,15 @@
+ def self.show_top_menu? + InfoCategory.categories.each {|catsym| + if (InfoCategory::is_shown?(catsym) or User.current.admin?) + return true + end + } + return false + end +
Index: init.rb
--- init.rb (revision 57) +++ init.rb (working copy) @@ -16,10 +16,13 @@
- :if => Proc.new { User.current.logged? }) + :if => Proc.new { User.current.logged? && InfoCategory.show_top_menu? })
+ActionDispatch::Callbacks.to_prepare do + require_dependency 'info_category' +end
Index: lib/info_category.rb
--- lib/info_category.rb (revision 57) +++ lib/info_category.rb (working copy) @@ -22,8 +22,7 @@
- - +
@@ -32,6 +31,15 @@
+ def self.show_top_menu? + InfoCategory.categories.each {|catsym| + if (InfoCategory::is_shown?(catsym) or User.current.admin?) + return true + end + } + return false + end +