Class: NfgUi::Bootstrap::Components::Button

Overview

Bootstrap Button Component getbootstrap.com/docs/4.1/components/buttons/

Direct Known Subclasses

Components::Elements::Button

Instance Attribute Summary

Attributes included from Utilities::Wrappable

#as

Attributes included from Utilities::Disableable

#as

Attributes inherited from Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Utilities::Wrappable

#utility_initialize

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

#outlined, #theme

Methods included from Utilities::Modalable

#data, #modal

Methods included from Utilities::Sizable

#size

Methods included from Utilities::Remotable

#data, #remote

Methods included from Utilities::CollapseToggleable

#data

Methods included from Utilities::Collapsible

#collapse, #collapsed, #collapsible

Methods included from Utilities::Activatable

#active

Methods inherited from Base

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

Constructor Details

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

Instance Method Details

#blockObject



33
34
35
# File 'lib/nfg_ui/bootstrap/components/button.rb', line 33

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

#hrefObject



37
38
39
40
# File 'lib/nfg_ui/bootstrap/components/button.rb', line 37

def href
  return if as != :a
  collapse || super || '#'
end

#remove_component_css_classesObject



42
43
44
# File 'lib/nfg_ui/bootstrap/components/button.rb', line 42

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

#renderObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nfg_ui/bootstrap/components/button.rb', line 19

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