Class: NfgUi::Bootstrap::Components::DropdownItem

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

Overview

Direct Known Subclasses

Components::Elements::DropdownItem

Instance Attribute Summary

Attributes included from Utilities::Disableable

#as

Attributes included from Utilities::Wrappable

#as

Attributes inherited from Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Utilities::Tooltipable

#data, #disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip

Methods included from Utilities::Disableable

#disabled

Methods included from Utilities::Activatable

#active

Methods included from Utilities::Wrappable

#utility_initialize

Methods inherited from Base

#data, #href, #html_options, #id, #style

Constructor Details

#initializeDropdownItem

We do not want to overwrite button_to’s interpretation of ‘remote`. Conditionally include Remotable when not using as: :button_to



17
18
19
20
21
22
# File 'lib/nfg_ui/bootstrap/components/dropdown_item.rb', line 17

def initialize(*)
  super
  if as != :button_to
    extend Bootstrap::Utilities::Remotable
  end
end

Instance Method Details

#component_familyObject



24
25
26
# File 'lib/nfg_ui/bootstrap/components/dropdown_item.rb', line 24

def component_family
  :dropdown
end

#renderObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nfg_ui/bootstrap/components/dropdown_item.rb', line 28

def render
  if tooltip && disabled
    (:span, disabled_component_tooltip_wrapper_html_options) do
      (as, html_options.except(:href)) do
        (block_given? ? yield : body)
      end
    end
  else
    (as, html_options) do
      (block_given? ? yield : body)
    end
  end
end