Sha256: 98f440bf2983a1921a658bcec45747d2ad1429b2f9e095ebbbcfd37246ca860f
Contents?: true
Size: 756 Bytes
Versions: 2
Compression:
Stored size: 756 Bytes
Contents
module Nesta module Navigation module Renderers def display_menu(menu, options = {}) defaults = { :class => nil, :levels => 2 } options = defaults.merge(options) if options[:levels] > 0 haml_tag :ul, :class => options[:class] do menu.each do |item| display_menu_item(item, options) end end end end def display_menu_item(item, options = {}) haml_tag :li do if item.respond_to?(:each) display_menu(item, :levels => (options[:levels] - 1)) else haml_tag :a, :href => item.abspath do haml_concat item.heading end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nesta-0.9.2 | lib/nesta/navigation.rb |
nesta-0.9.1 | lib/nesta/navigation.rb |