app/helpers/katalyst/navigation/frontend/builder.rb in katalyst-navigation-1.0.3 vs app/helpers/katalyst/navigation/frontend/builder.rb in katalyst-navigation-1.1.0
- old
+ new
@@ -6,35 +6,35 @@
class Builder
attr_accessor :template, :menu_options, :list_options, :item_options
delegate_missing_to :@template
- def initialize(template, menu: {}, list: {}, item: {})
+ def initialize(template, list: {}, item: {}, **menu_options)
self.template = template
- self.menu_options = menu
+ self.menu_options = menu_options
self.list_options = list
self.item_options = item
end
def render(tree)
- content_tag(:ul, menu_options) do
+ tag.ul **menu_options do
tree.each do |item|
concat render_item(item)
end
end
end
def render_item(item)
return unless item.visible?
- content_tag :li, item_options do
+ tag.li **item_options do
concat public_send("render_#{item.model_name.param_key}", item)
concat render_list(item.children) if item.children.any?
end
end
def render_list(items)
- content_tag :ul, list_options do
+ tag.ul **list_options do
items.each do |child|
concat render_item(child)
end
end
end