lib/simple_navigation.rb in simple-navigation-3.0.2 vs lib/simple_navigation.rb in simple-navigation-3.1.0

- old
+ new

@@ -111,18 +111,21 @@ config.primary_navigation end # Returns the active item container for the specified level. Valid levels are # * :all - in this case the primary_navigation is returned. + # * :leaves - the 'deepest' active item_container will be returned # * a specific level - the active item_container for the specified level will be returned # * a range of levels - the active item_container for the range's minimum will be returned # # Returns nil if there is no active item_container for the specified level. def active_item_container_for(level) case level when :all self.primary_navigation + when :leaves + self.primary_navigation.active_leaf_container when Integer self.primary_navigation.active_item_container_for(level) when Range self.primary_navigation.active_item_container_for(level.min) else @@ -140,10 +143,18 @@ # Then in the view you can call: # # render_navigation(:renderer => :my_renderer) def register_renderer(renderer_hash) self.registered_renderers.merge!(renderer_hash) - end + end + + private + + def apply_defaults(options) + options[:level] = options.delete(:levels) if options[:levels] + {:context => :default, :level => :all}.merge(options) + end + end end