Class: NfgUi::Components::Elements::Button
- Inherits:
-
Bootstrap::Components::Button
- Object
- Bootstrap::Components::Base
- Bootstrap::Components::Button
- NfgUi::Components::Elements::Button
- Includes:
- Traits::Active, Traits::Button, Traits::Disable, Traits::DisableWith, Traits::Remote, Traits::Size, Traits::Theme, Utilities::Confirmable, Utilities::Describable, Utilities::DisableWithable, Utilities::Iconable, Utilities::LeftIconable, Utilities::Methodable, Utilities::Renderable, Utilities::Traitable
- Defined in:
- lib/nfg_ui/components/elements/button.rb
Overview
Button doesn’t have any customizations unique to the design system yet As such, the NFG UI Button is simply a bootstrap Button behind the scenes. Traits will eventually be connected here.
Constant Summary
Constants included from Traits::Remote
Constants included from Traits::Disable
Constants included from Traits::Theme
Traits::Theme::COLOR_TRAITS, Traits::Theme::TRAITS
Constants included from Traits::Size
Constants included from Traits::DisableWith
Constants included from Traits::Button
Constants included from Traits::Active
Constants included from Traits
Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES
Instance Attribute Summary
Attributes included from Bootstrap::Utilities::Wrappable
Attributes included from Bootstrap::Utilities::Disableable
Attributes inherited from Bootstrap::Components::Base
#body, #options, #view_context
Instance Method Summary collapse
Methods included from Traits::Remote
Methods included from Traits::Disable
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::Size
#lg_trait, #md_trait, #sm_trait, #xl_trait
Methods included from Traits::DisableWith
Methods included from Traits::Button
#block_trait, #close_trait, #link_trait, #outlined_trait, #remote_trait, #submit_trait
Methods included from Traits::Active
Methods included from Utilities::Renderable
Methods included from Utilities::Describable
Methods included from Utilities::Traitable
Methods included from Utilities::LeftIconable
Methods included from Utilities::Iconable
Methods included from Utilities::DisableWithable
Methods included from Utilities::Confirmable
Methods inherited from Bootstrap::Components::Button
#block, #href, #remove_component_css_classes
Methods included from Bootstrap::Utilities::Wrappable
Methods included from Bootstrap::Utilities::Tooltipable
#disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip
Methods included from Bootstrap::Utilities::Disableable
Methods included from Bootstrap::Utilities::Themeable
Methods included from Bootstrap::Utilities::Modalable
Methods included from Bootstrap::Utilities::Sizable
Methods included from Bootstrap::Utilities::Remotable
Methods included from Bootstrap::Utilities::Collapsible
#collapse, #collapsed, #collapsible
Methods included from Bootstrap::Utilities::Activatable
Methods inherited from Bootstrap::Components::Base
#component_family, #href, #html_options, #id, #initialize, #style
Constructor Details
This class inherits a constructor from NfgUi::Bootstrap::Components::Base
Instance Method Details
#close ⇒ Object
TODO
32 33 34 35 |
# File 'lib/nfg_ui/components/elements/button.rb', line 32 def close # convert :close trait to # close: :alert end |
#data ⇒ Object
27 28 29 |
# File 'lib/nfg_ui/components/elements/button.rb', line 27 def data dismiss ? super.merge!(dismiss: dismiss) : super end |
#dismiss ⇒ Object
41 42 43 |
# File 'lib/nfg_ui/components/elements/button.rb', line 41 def dismiss .fetch(:dismiss, nil) end |
#method ⇒ Object
37 38 39 |
# File 'lib/nfg_ui/components/elements/button.rb', line 37 def method .fetch(:method, nil) end |
#render ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/nfg_ui/components/elements/button.rb', line 45 def render @body = yield if block_given? if tooltip && disabled content_tag(:span, ) do content_tag(as, ) do capture do concat(left_icon_component) if left_icon concat(body) concat(right_icon_component) if icon end end end else content_tag(as, ) do capture do concat(left_icon_component) if left_icon concat(body) concat(right_icon_component) if icon end end end end |