Class: NfgUi::Components::Elements::NavLink

Overview

Nav doc coming soon

Direct Known Subclasses

StepIndicator

Constant Summary

Constants included from Traits::Remote

Traits::Remote::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 inherited from Bootstrap::Components::Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Traits::Remote

#remote_trait

Methods included from Traits::Disable

#disabled_trait

Methods included from Traits::Active

#active_trait

Methods included from Utilities::Renderable

#render_if, #render_unless

Methods included from Utilities::Methodable

#data, #method

Methods included from Utilities::Iconable

#icon

Methods included from Utilities::Describable

#data, #describe

Methods included from Utilities::Traitable

#traits, #utility_initialize

Methods included from Bootstrap::Utilities::Modalable

#data, #modal

Methods included from Bootstrap::Utilities::CollapseToggleable

#data

Methods included from Bootstrap::Utilities::Collapsible

#collapse, #collapsed, #collapsible

Methods inherited from Bootstrap::Components::NavLink

#component_family, #data, #dropdown, #tab

Methods included from Bootstrap::Utilities::Remotable

#data, #remote

Methods included from Bootstrap::Utilities::Disableable

#disabled

Methods included from Bootstrap::Utilities::Activatable

#active

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



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

def render
  # Do NOT use :collapse while also using dropdown. That would be
  # self-defeating. Since a dropdown menu is a more specific type
  # of collapse component.
  if dropdown
    NfgUi::Components::Elements::DropdownToggle.new({ body: (block_given? ? yield : body), as: :a, **html_options, theme: nil, nav_link: true }, view_context).render
  else
    (:a, html_options) do
      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