Class: NfgUi::Components::Elements::SlatItem
- Inherits:
-
Base
- Object
- Bootstrap::Components::Base
- Base
- NfgUi::Components::Elements::SlatItem
- Includes:
- Bootstrap::Utilities::Headable, Bootstrap::Utilities::Sizable, Traits::Size, Traits::SlatItem
- Defined in:
- lib/nfg_ui/components/elements/slat_item.rb
Overview
Slat doc coming soon
Constant Summary
Constants included from Traits::SlatItem
Constants included from Traits::Size
Constants included from Traits
Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES
Instance Attribute Summary
Attributes inherited from Bootstrap::Components::Base
#body, #options, #view_context
Instance Method Summary collapse
- #caption ⇒ Object
- #component_family ⇒ Object
- #render ⇒ Object
- #slat_header ⇒ Object
-
#tooltip ⇒ Object
Leverage custom tooltip implementation so that tooltips are connected to slat item text and not the slat item containing div (resulting in better UI).
Methods included from Traits::SlatItem
Methods included from Traits::Size
#lg_trait, #md_trait, #sm_trait, #xl_trait
Methods included from Bootstrap::Utilities::Sizable
Methods included from Bootstrap::Utilities::Headable
Methods included from Utilities::Traitable
Methods included from Utilities::Renderable
Methods included from Utilities::Describable
Methods inherited from Bootstrap::Components::Base
#data, #href, #html_options, #id, #initialize, #style
Constructor Details
This class inherits a constructor from NfgUi::Bootstrap::Components::Base
Instance Method Details
#caption ⇒ Object
14 15 16 |
# File 'lib/nfg_ui/components/elements/slat_item.rb', line 14 def .fetch(:caption, nil) end |
#component_family ⇒ Object
18 19 20 |
# File 'lib/nfg_ui/components/elements/slat_item.rb', line 18 def component_family :slats end |
#render ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/nfg_ui/components/elements/slat_item.rb', line 33 def render content_tag(base_element, ) do if slat_header concat(content_tag(:h6, slat_header, class: 'display-4 slat-column-header', **)) end if heading if href concat(content_tag(:a, href: view_context.url_for(href)) { NfgUi::Components::Foundations::Typeface.new({ subheading: heading, tooltip: tooltip }, view_context).render }) else concat(NfgUi::Components::Foundations::Typeface.new({ subheading: heading, tooltip: tooltip }, view_context).render) end end concat(block_given? ? yield : body) if concat(NfgUi::Components::Foundations::Typeface.new({ caption: , class: 'mb-0', tooltip: (tooltip unless heading) }, view_context).render) end end end |
#slat_header ⇒ Object
22 23 24 |
# File 'lib/nfg_ui/components/elements/slat_item.rb', line 22 def slat_header .fetch(:slat_header, nil) end |
#tooltip ⇒ Object
Leverage custom tooltip implementation so that tooltips are connected to slat item text and not the slat item containing div (resulting in better UI)
29 30 31 |
# File 'lib/nfg_ui/components/elements/slat_item.rb', line 29 def tooltip .fetch(:tooltip, nil) end |