Class: NfgUi::Components::Patterns::TileHeader
- Inherits:
-
Base
- Object
- Bootstrap::Components::Base
- Base
- NfgUi::Components::Patterns::TileHeader
- Defined in:
- lib/nfg_ui/components/patterns/tile_header.rb
Overview
TileHeader doc coming soon
Constant Summary
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
Methods included from Utilities::Iconable
Methods included from Utilities::Titleable
Methods included from Bootstrap::Utilities::Collapsible
#collapse, #collapsed, #collapsible
Methods included from Utilities::Traitable
Methods included from Utilities::Renderable
Methods included from Utilities::Describable
Methods inherited from Bootstrap::Components::Base
#data, #html_options, #id, #initialize, #style
Constructor Details
This class inherits a constructor from NfgUi::Bootstrap::Components::Base
Instance Method Details
#button ⇒ Object
17 18 19 |
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 17 def .fetch(:button, nil) end |
#component_family ⇒ Object
13 14 15 |
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 13 def component_family :tile end |
#href ⇒ Object
21 22 23 |
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 21 def href .fetch(:href, nil) end |
#render ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 29 def render super do if title concat(content_tag(:div, class: 'row') do concat(content_tag(:div, class: "col") do content_tag(:div, class: 'row') do concat(content_tag(:div, class: 'col-12 col-md') do concat(NfgUi::Components::Foundations::Typeface.new({ heading: title, icon: icon, class: 'h4' }, view_context).render) if subtitle concat(NfgUi::Components::Foundations::Typeface.new({ body: subtitle, traits: [:muted], class: 'mt-1 mb-0' }, view_context).render) end end) if concat(content_tag(:div, class: 'col-12 col-md-auto mt-md-0 mt-2') do NfgUi::Components::Elements::Button.new({theme: :secondary, href: href, body: }, view_context).render end) end end end) if collapsible concat(content_tag(:div, class: 'col-auto pl-0') do NfgUi::Components::Elements::Button.new({ traits: [:link], collapse: collapse, data: { collapse_icon: collapse_icon, collapsed_icon: collapsed_icon } }, view_context).render do # The button cannot host a data-toggle for tooltip # and a data-toggle for collapse # In order to accomodate the tooltip, we have to # render the icon manually without using the button's # options so that we're applying the tooltip on the # icon and not the button. NfgUi::Components::Foundations::Icon.new({ traits: ["#{contextual_collapsible_icon} fw"], tooltip: 'Show / hide additional information' }, view_context).render end end) end end) end concat((block_given? ? yield : body)) end end |
#subtitle ⇒ Object
25 26 27 |
# File 'lib/nfg_ui/components/patterns/tile_header.rb', line 25 def subtitle .fetch(:subtitle, nil) end |