class NfgUi::Components::Patterns::TileHeader
TileHeader
doc coming soon
Public Instance Methods
component_family()
click to toggle source
# File lib/nfg_ui/components/patterns/tile_header.rb, line 13 def component_family :tile end
href()
click to toggle source
# File lib/nfg_ui/components/patterns/tile_header.rb, line 21 def href options.fetch(:href, nil) end
render() { |: body))| ... }
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Components::Base#render
# 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 button 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: button}, 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()
click to toggle source
# File lib/nfg_ui/components/patterns/tile_header.rb, line 25 def subtitle options.fetch(:subtitle, nil) end
Private Instance Methods
collapse_icon()
click to toggle source
# File lib/nfg_ui/components/patterns/tile_header.rb, line 79 def collapse_icon 'caret-up' end
collapsed_icon()
click to toggle source
# File lib/nfg_ui/components/patterns/tile_header.rb, line 83 def collapsed_icon 'caret-down' end
contextual_collapsible_icon()
click to toggle source
# File lib/nfg_ui/components/patterns/tile_header.rb, line 74 def contextual_collapsible_icon return '' unless collapsible collapsed ? collapsed_icon : collapse_icon end
non_html_attribute_options()
click to toggle source
Calls superclass method
NfgUi::Components::Utilities::Iconable#non_html_attribute_options
# File lib/nfg_ui/components/patterns/tile_header.rb, line 87 def non_html_attribute_options super.push(:subtitle, :button, :href) end