Class: Navtastic::Renderer::Bootstrap4

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

Overview

This renderer adds css classes and structure for the bootstrap 4 framework

Instance Method Summary collapse

Methods inherited from Navtastic::Renderer

#menu_inside_container?, render

Instance Method Details

#item_content(item) ⇒ Object



21
22
23
24
25
26
# File 'lib/navtastic/renderer/bootstrap4.rb', line 21

def item_content(item)
  element = super(item)
  element.class_list << 'nav-link'
  element.class_list << 'active' if item.current?
  element
end

#item_tag(item) ⇒ Object



15
16
17
18
19
# File 'lib/navtastic/renderer/bootstrap4.rb', line 15

def item_tag(item)
  element = super(item)
  element.class_list << 'nav-item'
  element
end


8
9
10
11
12
13
# File 'lib/navtastic/renderer/bootstrap4.rb', line 8

def menu_tag(_menu)
  class_list = ['nav']
  class_list << 'flex-column' if vertical?

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