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
50 51 52 53 54 55 56 |
# File 'lib/para/markup/modal.rb', line 50 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 21 22 23 24 25 26 27 28 |
# 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] ) [:data] ||= {} [:data]['para-admin-modal-target'] ||= 'modal' content_tag(:div, ) do content_tag(:div, class: 'modal-dialog') do content_tag(:div, class: 'modal-content') do content_tag(:div, class: 'modal-inner') do capture { block.call(self) } end end end end end |
#footer(options = {}, &block) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/para/markup/modal.rb', line 58 def ( = {}, &block) merge_class!(, 'modal-footer') content_tag(:div, ) do capture { block.call } end end |
#header(options = {}, &block) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/para/markup/modal.rb', line 30 def header( = {}, &block) merge_class!(, 'modal-header') content_tag(:div, ) do content_tag( :button, '×'.html_safe, class: 'close', type: 'button', 'aria-hidden' => 'true', data: { action: 'click->para-admin-modal#closeModal' } ) + content_tag(:h4, class: 'modal-title') do capture { block.call } end end end |