Class: FoundationNavigation::TitleArea

Inherits:
Object
  • Object
show all
Includes:
Builder
Defined in:
lib/foundation-navigation/title_area.rb

Instance Attribute Summary

Attributes included from Builder

#node

Instance Method Summary collapse

Methods included from Builder

#build_subtree, #divider, #dropdown, #left, #menu_group, #menu_item, #method_missing, #right, #title_area, #to_s

Constructor Details

#initialize(title: nil, title_link: nil, menu_text: 'Menu', menu_icon: true) ⇒ TitleArea

Returns a new instance of TitleArea.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/foundation-navigation/title_area.rb', line 9

def initialize(title: nil, title_link: nil, menu_text: 'Menu', menu_icon:
               true)
  ul(class: 'title-area') do
    if title.present?
      li(class: 'name') { h1 { a(href: title_link || '#') {  title } } }
    else
      li(class: 'name')
    end

    toggle_opts = { class: 'toggle-topbar' }
    toggle_opts[:class] << ' menu-icon' if menu_icon
    li(toggle_opts) { a(href: '#') { span { menu_text } } }
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FoundationNavigation::Builder