lib/simple_navigation/item_container.rb in simple-navigation-2.0.1 vs lib/simple_navigation/item_container.rb in simple-navigation-2.1.0
- old
+ new
@@ -30,10 +30,17 @@
# be rendered (e.g. <tt>:unless => Proc.new { current_user.admin? }</tt>). The
# proc should evaluate to a true or false value and is evaluated in the context of the view.
#
# The <tt>block</tt> - if specified - will hold the item's sub_navigation.
def item(key, name, url, options={}, &block)
- (@items << SimpleNavigation::Item.new(self, key, name, url, options, block)) if should_add_item?(options)
+ (@items << SimpleNavigation::Item.new(self, key, name, url, options, nil, &block)) if should_add_item?(options)
+ end
+
+ def items=(items)
+ items.each do |item|
+ item = SimpleNavigation::ItemAdapter.new(item)
+ (@items << item.to_simple_navigation_item(self)) if should_add_item?(item.options)
+ end
end
# Returns the Item with the specified key, nil otherwise.
#
def [](navi_key)
\ No newline at end of file