Class: Navtastic::Renderer::Foundation6

Inherits:
Navtastic::Renderer show all
Defined in:
lib/navtastic/renderer/foundation6.rb

Overview

This renderer adds css classes and structure for the foundation 6 framework

Instance Method Summary collapse

Methods inherited from Navtastic::Renderer

#menu_inside_container?, render

Instance Method Details

#item_content(item) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/navtastic/renderer/foundation6.rb', line 31

def item_content(item)
  element = if item.url?
              a(href: item.url) { item.name }
            elsif drilldown?
              a(href: '#') { item.name }
            else
              span(class: 'menu-text') { item.name }
            end

  if drilldown? && item.active? && options[:active_class]
    element.class_list << options[:active_class]
  end

  element
end

#item_tag(item) ⇒ Object



25
26
27
28
29
# File 'lib/navtastic/renderer/foundation6.rb', line 25

def item_tag(item)
  element = super(item)
  element.class_list << 'is-active' if item.current?
  element
end


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/navtastic/renderer/foundation6.rb', line 10

def menu_tag(menu)
  class_list = ['menu']
  class_list << 'vertical' if vertical?
  class_list << 'nested' unless menu.root?

  list = ul(class: class_list.join(' ')) { yield }

  if drilldown? && menu.root?
    list.class_list << 'drilldown'
    list.set_attribute('data-drilldown', true)
  end

  list
end