Class: NfgUi::Components::Elements::Alert
- Inherits:
-
Bootstrap::Components::Alert
- Object
- Bootstrap::Components::Base
- Bootstrap::Components::Alert
- NfgUi::Components::Elements::Alert
- Includes:
- Traits::Alert, Traits::Dismiss, Traits::Theme, Utilities::Describable, Utilities::Iconable, Utilities::Renderable, Utilities::Traitable
- Defined in:
- lib/nfg_ui/components/elements/alert.rb
Overview
Alert doesn’t have any customizations unique to the design system yet As such, the NFG UI alert is simply a bootstrap alert behind the scenes. Traits will eventually be connected here.
Constant Summary
Constants included from Traits::Theme
Traits::Theme::COLOR_TRAITS, Traits::Theme::TRAITS
Constants included from Traits::Dismiss
Constants included from Traits::Alert
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 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::Dismiss
Methods included from Traits::Alert
Methods included from Utilities::Renderable
Methods included from Utilities::Describable
Methods included from Utilities::Traitable
Methods included from Utilities::Iconable
Methods included from Bootstrap::Utilities::Themeable
Methods included from Bootstrap::Utilities::Headable
Methods included from Bootstrap::Utilities::Dismissible
Methods inherited from Bootstrap::Components::Base
#component_family, #data, #href, #html_options, #id, #initialize, #style
Constructor Details
This class inherits a constructor from NfgUi::Bootstrap::Components::Base
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 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 |
# File 'lib/nfg_ui/components/elements/alert.rb', line 19 def render # NOTE: concat statement must be surrounded by capture blocks. # If you see duplication of content, it is likely because that # a concat has been called outside of a capture block. # This is specifically true when some of those concats are nested # or are within a block defined within the capture block content_tag(:div, ) do capture do if dismissible concat(NfgUi::Components::Elements::Button.new({ traits: [:close], dismiss: :alert }, view_context).render) end if icon concat(NfgUi::Components::Patterns::Media.new({}, view_context).render { capture do concat(NfgUi::Components::Elements::MediaObject.new({}, view_context).render { content_tag(:div, class: 'mr-2') do NfgUi::Components::Foundations::Icon.new({ traits: [icon] }, view_context).render end }) concat(NfgUi::Components::Elements::MediaBody.new({}, view_context).render { capture do if heading concat(NfgUi::Components::Foundations::Typeface.new({ heading: heading, class: 'alert-heading' }, view_context).render) end concat(block_given? ? yield : body) end }) end }) else if heading concat(NfgUi::Components::Foundations::Typeface.new({ heading: heading, class: 'alert-heading' }, view_context).render) end concat(block_given? ? yield : body) end end end end |