Class: NfgUi::Bootstrap::Components::NavLink

Inherits:
Base
  • Object
show all
Includes:
Utilities::Activatable, Utilities::Disableable, Utilities::Remotable
Defined in:
lib/nfg_ui/bootstrap/components/nav_link.rb

Overview

Direct Known Subclasses

Components::Elements::NavLink

Instance Attribute Summary

Attributes included from Utilities::Disableable

#as

Attributes inherited from Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Utilities::Remotable

#remote

Methods included from Utilities::Disableable

#disabled

Methods included from Utilities::Activatable

#active

Methods inherited from Base

#href, #html_options, #id, #initialize, #style

Constructor Details

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

Instance Method Details

#component_familyObject



13
14
15
# File 'lib/nfg_ui/bootstrap/components/nav_link.rb', line 13

def component_family
  :nav
end

#dataObject



25
26
27
# File 'lib/nfg_ui/bootstrap/components/nav_link.rb', line 25

def data
  tab ? super.merge!(toggle: 'tab') : super
end


17
18
19
# File 'lib/nfg_ui/bootstrap/components/nav_link.rb', line 17

def dropdown
  options.fetch(:dropdown, false)
end

#renderObject



29
30
31
32
33
34
35
# File 'lib/nfg_ui/bootstrap/components/nav_link.rb', line 29

def render
  if dropdown
    NfgUi::Bootstrap::Components::DropdownToggle.new({ body: (block_given? ? yield : body), as: :a, **html_options, theme: nil, nav_link: true }, view_context).render
  else
    super
  end
end

#tabObject



21
22
23
# File 'lib/nfg_ui/bootstrap/components/nav_link.rb', line 21

def tab
  options.fetch(:tab, nil)
end