Class: Bootstrap4RailsComponents::Bootstrap::Components::Alert
- Defined in:
- lib/bootstrap4_rails_components/bootstrap/components/alert.rb
Overview
Bootstrap Alert Component getbootstrap.com/docs/4.1/components/alerts/
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary collapse
Methods included from Utilities::Themeable
Methods included from Utilities::Headable
Methods included from Utilities::Dismissible
Methods inherited from Base
#component_family, #component_initialize, #data, #href, #html_options, #id, #initialize, #style, #utility_initialize
Constructor Details
This class inherits a constructor from Bootstrap4RailsComponents::Bootstrap::Components::Base
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bootstrap4_rails_components/bootstrap/components/alert.rb', line 13 def render content_tag(:div, ) do capture do if dismissible concat( Bootstrap4RailsComponents::Bootstrap::Components::Button.new({ as: :button, class: 'close', theme: nil, data: { dismiss: 'alert' }, aria: { label: 'Close' } }, view_context).render do content_tag(:span, "×".html_safe, aria: { hidden: 'true' } ) end ) end if heading concat(content_tag(:h4, heading, class: 'alert-heading')) end concat(block_given? ? yield : body) end end end |