Module: ModalHelper
- Defined in:
- app/helpers/modal_helper.rb
Instance Method Summary collapse
- #modal_body(options = {}, escape = true, &block) ⇒ Object
- #modal_cancel_button(content, options = {}) ⇒ Object
- #modal_dialog(options = {}, escape = true, &block) ⇒ Object
- #modal_footer(options = {}, escape = true, &block) ⇒ Object
- #modal_header(options = {}, escape = true, &block) ⇒ Object
- #modal_toggle(content_or_options = nil, options = {}, &block) ⇒ Object
Instance Method Details
#modal_body(options = {}, escape = true, &block) ⇒ Object
14 15 16 17 |
# File 'app/helpers/modal_helper.rb', line 14 def modal_body( = {}, escape = true, &block) = { class: 'modal-body' } content_tag :div, nil, .merge(), escape, &block end |
#modal_cancel_button(content, options = {}) ⇒ Object
36 37 38 39 40 |
# File 'app/helpers/modal_helper.rb', line 36 def (content, = {}) = { class: 'btn bootstrap-modal-cancel-button' } content_tag_string 'a', content, .merge() end |
#modal_dialog(options = {}, escape = true, &block) ⇒ Object
2 3 4 5 |
# File 'app/helpers/modal_helper.rb', line 2 def modal_dialog( = {}, escape = true, &block) = { class: 'bootstrap-modal modal' } content_tag :div, nil, .merge(), escape, &block end |
#modal_footer(options = {}, escape = true, &block) ⇒ Object
19 20 21 22 |
# File 'app/helpers/modal_helper.rb', line 19 def ( = {}, escape = true, &block) = { class: 'modal-footer' } content_tag :div, nil, .merge(), escape, &block end |
#modal_header(options = {}, escape = true, &block) ⇒ Object
7 8 9 10 11 12 |
# File 'app/helpers/modal_helper.rb', line 7 def modal_header( = {}, escape = true, &block) = { class: 'modal-header' } content_tag :div, nil, .merge(), escape do raw('<button class="close" data-dismiss="modal">×</button>' + capture(&block)) end end |
#modal_toggle(content_or_options = nil, options = {}, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/modal_helper.rb', line 24 def modal_toggle( = nil, = {}, &block) if block_given? = if .is_a?(Hash) = { :class => 'btn', 'data-toggle' => 'modal', 'href' => [:dialog] }.merge() content_tag :a, nil, , true, &block else = { :class => 'btn', 'data-toggle' => 'modal', 'href' => [:dialog] }.merge() content_tag :a, , , true end end |