Class: NfgUi::Components::Elements::DropdownItem

Overview

Ino coming soon.

Direct Known Subclasses

SlatAction

Constant Summary

Constants included from Traits::Theme

Traits::Theme::COLOR_TRAITS, Traits::Theme::TRAITS

Constants included from Traits::Disable

Traits::Disable::TRAITS

Constants included from Traits::DisableWith

Traits::DisableWith::TRAITS

Constants included from Traits::Active

Traits::Active::TRAITS

Constants included from Traits::Remote

Traits::Remote::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::Theme

#danger_trait, #dark_trait, #info_trait, #light_trait, #outlined_trait, #primary_trait, #secondary_trait, #success_trait, #warning_trait, #white_trait

Methods included from Traits::Disable

#disabled_trait

Methods included from Traits::DisableWith

#disable_with_trait

Methods included from Traits::Active

#active_trait

Methods included from Traits::Remote

#remote_trait

Methods included from Utilities::Traitable

#traits, #utility_initialize

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::DisableWithable

#data, #disable_with

Methods included from Utilities::Describable

#data, #describe

Methods included from Utilities::Confirmable

#confirm, #data

Methods included from Bootstrap::Utilities::Modalable

#data, #modal

Methods included from Bootstrap::Utilities::Themeable

#outlined, #theme

Methods inherited from Bootstrap::Components::DropdownItem

#component_family

Methods included from Bootstrap::Utilities::Remotable

#data, #remote

Methods included from Bootstrap::Utilities::Tooltipable

#data, #disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip

Methods included from Bootstrap::Utilities::Disableable

#disabled

Methods included from Bootstrap::Utilities::Activatable

#active

Methods included from Bootstrap::Utilities::Wrappable

#utility_initialize

Methods inherited from Bootstrap::Components::Base

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

Constructor Details

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

Instance Method Details

#hrefObject

Automatically supply an :href to the dropdown item when a modal is present so that the dropdown item presents correctly and appears clickable



49
50
51
# File 'lib/nfg_ui/components/elements/dropdown_item.rb', line 49

def href
  super || (modal ? '#' : nil)
end

#renderObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/nfg_ui/components/elements/dropdown_item.rb', line 25

def render
  if tooltip && disabled
    (:span, disabled_component_tooltip_wrapper_html_options) do
      (as, html_options.except(:href)) do
        if icon
          NfgUi::Components::Foundations::Icon.new({ traits: ["#{icon} fw"], text: (block_given? ? yield : body), class: 'text-center' }, view_context).render
        else
          (block_given? ? yield : body)
        end
      end
    end
  else
    super do
      if icon
        NfgUi::Components::Foundations::Icon.new({ traits: ["#{icon} fw"], text: (block_given? ? yield : body), class: 'text-center' }, view_context).render
      else
        (block_given? ? yield : body)
      end
    end
  end
end