Class: NfgUi::Components::Elements::NavItem

Overview

Nav doc coming soon

Direct Known Subclasses

Step

Constant Summary

Constants included from Traits::Remote

Traits::Remote::TRAITS

Constants included from Traits::NavItem

Traits::NavItem::TRAITS

Constants included from Traits::Disable

Traits::Disable::TRAITS

Constants included from Traits::Active

Traits::Active::TRAITS

Constants included from Traits

Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES

Instance Attribute Summary

Attributes included from Bootstrap::Utilities::Disableable

#as

Attributes included from Bootstrap::Utilities::Wrappable

#as

Attributes inherited from Bootstrap::Components::Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Traits::Remote

#remote_trait

Methods included from Traits::NavItem

#dropdown_trait

Methods included from Traits::Disable

#disabled_trait

Methods included from Traits::Active

#active_trait

Methods included from Utilities::Traitable

#traits, #utility_initialize

Methods included from Utilities::Renderable

#render_if, #render_unless

Methods included from Utilities::Describable

#data, #describe

Methods included from Utilities::Iconable

#icon

Methods included from Bootstrap::Utilities::Tooltipable

#data, #disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip

Methods included from Bootstrap::Utilities::Disableable

#disabled

Methods inherited from Bootstrap::Components::NavItem

#active, #button, #component_family, #disabled, #dropdown, #html_options, #include_nav_link?, #remote, #tab

Methods included from Bootstrap::Utilities::Wrappable

#utility_initialize

Methods inherited from Bootstrap::Components::Base

#component_family, #data, #href, #html_options, #id, #initialize, #style

Constructor Details

This class inherits a constructor from NfgUi::Bootstrap::Components::Base

Instance Method Details

#renderObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nfg_ui/components/elements/nav_item.rb', line 20

def render
  (as, html_options) do
    if include_nav_link?
      concat(NfgUi::Components::Elements::NavLink.new({ body: (button ? button : (block_given? ? yield : body)), active: active, disabled: disabled, dropdown: dropdown, tab: tab, remote: remote, href: (tab || href), icon: icon }, view_context).render)
      if dropdown
        concat(block_given? ? yield : body)
      end
    else
      if icon
        NfgUi::Components::Foundations::Icon.new({ traits: [icon], text: (block_given? ? yield : body) }, view_context).render
      else
        (block_given? ? yield : body)
      end
    end
  end
end