Class: Para::Markup::Modal
- Defined in:
- lib/para/markup/modal.rb
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
- #body(options = {}, &block) ⇒ Object
- #container(options = {}, &block) ⇒ Object
- #footer(options = {}, &block) ⇒ Object
- #header(options = {}, &block) ⇒ Object
Methods inherited from Component
Constructor Details
This class inherits a constructor from Para::Markup::Component
Instance Method Details
#body(options = {}, &block) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/para/markup/modal.rb', line 35 def body( = {}, &block) merge_class!(, "modal-body") content_tag(:div, ) do capture { block.call } end end |
#container(options = {}, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/para/markup/modal.rb', line 4 def container( = {}, &block) merge_class!(, "modal") merge_class!(, "fade") unless .delete(:fade) == false merge_class!(, "in") if .delete(:displayed) .reverse_merge!( tabindex: "-1", role: "dialog", "aria-hidden" => "true", "aria-labelledby" => ([:id] || "modal") ) content_tag(:div, ) do content_tag(:div, class: "modal-dialog") do content_tag(:div, class: "modal-content") do capture { block.call(self) } end end end end |
#footer(options = {}, &block) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/para/markup/modal.rb', line 43 def ( = {}, &block) merge_class!(, "modal-footer") content_tag(:div, ) do capture { block.call } end end |
#header(options = {}, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/para/markup/modal.rb', line 22 def header( = {}, &block) merge_class!(, "modal-header") content_tag(:div, ) do content_tag(:button, "×".html_safe, class: "close", type: "button", "data-dismiss" => "modal", "aria-hidden" => "true" ) + content_tag(:h4, class: "modal-title") do capture { block.call } end end end |