Class: SimplerNavigation::Renderers::List

Inherits:
Base
  • Object
show all
Defined in:
lib/simpler_navigation/renderers/list.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #item, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SimplerNavigation::Renderers::Base

Instance Method Details

#renderObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/simpler_navigation/renderers/list.rb', line 6

def render
  return "" if @item.nil?

  list = []
  @item.children.each_value do |item|
    next unless show?(item)

    li_content = link_tag(item)
    if include_sub_navigation?(item)
      li_content << List.new(@context, item, @options).render
    end

    if @options[:render_content_partials] && item.options[:content_partial]
      li_content << @context.render(partial: item.options[:content_partial])
    end

    list << (:li, li_content, wrapper_tag_options(item))
  end

  (:ul, safe_join(list), @options[:attributes])
end