Class: NfgUi::Components::Patterns::PageHeader
- Inherits:
-
Base
- Object
- Bootstrap::Components::Base
- Base
- NfgUi::Components::Patterns::PageHeader
- Includes:
- Traits::PageHeader, Utilities::BrowserDetectable, Utilities::Renderable, Utilities::Titleable
- Defined in:
- lib/nfg_ui/components/patterns/page_header.rb
Overview
PageHeader doc coming soon
Constant Summary
Constants included from Traits::PageHeader
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
- #data ⇒ Object
- #render ⇒ Object
- #resource_theme_color ⇒ Object
-
#resource_theme_icon ⇒ Object
TODO: These resource_theme methods are just temporary placeholders.
- #sticky ⇒ Object
- #subtitle ⇒ Object
Methods included from Traits::PageHeader
Methods included from Utilities::Renderable
Methods included from Utilities::BrowserDetectable
Methods included from Utilities::Titleable
Methods included from Utilities::Traitable
Methods included from Utilities::Describable
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
#data ⇒ Object
14 15 16 |
# File 'lib/nfg_ui/components/patterns/page_header.rb', line 14 def data sticky ? super.merge!(toggle: 'sticky-div') : super end |
#render ⇒ Object
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 71 72 73 74 75 |
# File 'lib/nfg_ui/components/patterns/page_header.rb', line 37 def render [:class] ||= '' [:class] << ' container-fluid' content_tag(:div, ) do content_tag(:div, class: 'row') do content_tag(:div, class: 'col col-xl-11 mx-auto') do content_tag(:div, class: 'row align-items-center') do concat(content_tag(:div, class: 'col py-2') { NfgUi::Components::Patterns::Media.new({}, view_context).render do capture do concat(NfgUi::Components::Elements::MediaObject.new({}, view_context).render { content_tag(:div, class: 'mr-2 h2') do NfgUi::Components::Foundations::Icon.new({ traits: [resource_theme_icon], class: "text-#{resource_theme_color} mr-0" }, view_context).render end }) concat(NfgUi::Components::Elements::MediaBody.new({}, view_context).render { content_tag(:h2) do concat(title) if subtitle concat(content_tag(:small, subtitle, class: 'text-muted')) end end }) end end }) if body concat(content_tag(:div, class: 'col-12 col-md-auto py-2') { NfgUi::Components::Patterns::ButtonToolbar.new({ class: 'align-items-center' }, view_context).render do (block_given? ? yield : body) end }) end end end end end end |
#resource_theme_color ⇒ Object
33 34 35 |
# File 'lib/nfg_ui/components/patterns/page_header.rb', line 33 def resource_theme_color 'primary' end |
#resource_theme_icon ⇒ Object
TODO: These resource_theme methods are just temporary placeholders. They need to come from ResourceThemeable somehow.
29 30 31 |
# File 'lib/nfg_ui/components/patterns/page_header.rb', line 29 def resource_theme_icon 'heart-o' end |
#sticky ⇒ Object
18 19 20 21 |
# File 'lib/nfg_ui/components/patterns/page_header.rb', line 18 def sticky return if Rails.env.test? || browser.mobile? .fetch(:sticky, true) end |
#subtitle ⇒ Object
23 24 25 |
# File 'lib/nfg_ui/components/patterns/page_header.rb', line 23 def subtitle .fetch(:subtitle, nil) end |