Module: SemanticNavigation::Renderers::MixIn::ActsAsList
- Included in:
- List, TwitterBootstrap3::List, TwitterBootstrap3::Tabs, TwitterBootstrap::List, TwitterBootstrap::Tabs
- Defined in:
- lib/semantic_navigation/renderers/mix_in/acts_as_list.rb
Instance Method Summary collapse
- #render_leaf(object) ⇒ Object
- #render_navigation(object) ⇒ Object
- #render_node(object) ⇒ Object
- #render_node_content(object) ⇒ Object
Instance Method Details
#render_leaf(object) ⇒ Object
41 42 43 44 45 |
# File 'lib/semantic_navigation/renderers/mix_in/acts_as_list.rb', line 41 def render_leaf(object) if !object.id.in?([except_for].flatten) && object.render_if leaf(object) end end |
#render_navigation(object) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/semantic_navigation/renderers/mix_in/acts_as_list.rb', line 6 def (object) return '' unless object.render_if (object) do while !object.class.in?([SemanticNavigation::Core::Leaf, NilClass]) && from_level.to_i > object.level object = object.sub_elements.find{|e| e.active} end show = !until_level.nil? && !object.nil? ? object.level <= until_level : true if !object.class.in?([SemanticNavigation::Core::Leaf, NilClass]) && show object.sub_elements.map{|element| element.render(self)}.compact.sum end end end |
#render_node(object) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/semantic_navigation/renderers/mix_in/acts_as_list.rb', line 20 def render_node(object) if !object.id.in?([except_for].flatten) && object.render_if content = render_node_content(object) if content node(object) do content end else render_leaf(object) end end end |
#render_node_content(object) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/semantic_navigation/renderers/mix_in/acts_as_list.rb', line 33 def render_node_content(object) if (!until_level.nil? && until_level >= object.level) || until_level.nil? node_content(object) do object.sub_elements.map{|element| element.render(self)}.compact.sum end end end |