Class: NfgUi::Bootstrap::Components::Modal
- Defined in:
- lib/nfg_ui/bootstrap/components/modal.rb
Overview
Bootstrap Modal Component getbootstrap.com/docs/4.1/components/modal/
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary collapse
-
#component_family ⇒ Object
NOTE: ARIALABELLEDBY has not been introduced on speed modals.
- #footer ⇒ Object
- #render ⇒ Object
- #render_in_body ⇒ Object
- #size ⇒ Object
- #title ⇒ Object
Methods inherited from Base
#data, #href, #html_options, #id, #initialize, #style
Constructor Details
This class inherits a constructor from NfgUi::Bootstrap::Components::Base
Instance Method Details
#component_family ⇒ Object
NOTE: ARIALABELLEDBY has not been introduced on speed modals. ex: aria-labelledby=“exampleModalLabel” which is then the ID of the modal title element
14 15 16 |
# File 'lib/nfg_ui/bootstrap/components/modal.rb', line 14 def component_family :modal end |
#footer ⇒ Object
22 23 24 |
# File 'lib/nfg_ui/bootstrap/components/modal.rb', line 22 def .fetch(:footer, nil) end |
#render ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/nfg_ui/bootstrap/components/modal.rb', line 26 def render super do content_tag(:div, class: modal_dialog_css_classes, role: 'document') do content_tag(:div, class: 'modal-content') do capture do # Optionally, leave title nil # and the title / dismiss functionality is left out. if title.present? concat(NfgUi::Bootstrap::Components::ModalHeader.new({ title: title }, view_context).render) end if render_in_body concat(NfgUi::Bootstrap::Components::ModalBody.new({ body: (block_given? ? yield : body) }, view_context).render) else concat(block_given? ? yield : body) end if concat(NfgUi::Bootstrap::Components::ModalFooter.new({ body: }, view_context).render) end end end end end end |
#render_in_body ⇒ Object
50 51 52 |
# File 'lib/nfg_ui/bootstrap/components/modal.rb', line 50 def render_in_body .fetch(:render_in_body, true) end |
#size ⇒ Object
54 55 56 |
# File 'lib/nfg_ui/bootstrap/components/modal.rb', line 54 def size .fetch(:size, nil) end |
#title ⇒ Object
18 19 20 |
# File 'lib/nfg_ui/bootstrap/components/modal.rb', line 18 def title .fetch(:title, nil) end |