You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is due to how the controller instance is passed into the SemanticMenu intializer. Still, to get this instance to each
module MenuHelper
def semantic_menu(opts={}, &block)
# controller is not available in this context, but @controller is
SemanticMenu.new(opts, &block).to_s(controller)
end
end
#...
ActionView::Base.send :include, MenuHelper
Additionally, we need to fix how the child menu items are being passed a controller instance.
class SemanticMenu < MenuItem
def initialize(opts={},&block)
@opts = {:class => 'menu'}.merge opts
@level = 0
@children = []
yield self if block_given?
end
def to_s(controller=nil)
@controller = controller
# we need to pass the @controller instance to each child as well
content_tag(:ul, @children.collect(&:to_s).join, @opts)
end
end
The text was updated successfully, but these errors were encountered:
This is due to how the controller instance is passed into the SemanticMenu intializer. Still, to get this instance to each
module MenuHelper
def semantic_menu(opts={}, &block)
# controller is not available in this context, but @controller is
SemanticMenu.new(opts, &block).to_s(controller)
end
end
Additionally, we need to fix how the child menu items are being passed a controller instance.
The text was updated successfully, but these errors were encountered: