Module: BootstrapRailsHelpers::ModalHelper
- Defined in:
- app/helpers/bootstrap_rails_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(content_or_options_with_block = nil, options = {}, escape = true, &block) ⇒ Object
- #modal_toggle(content_or_options = {}, options = {}, &block) ⇒ Object
Instance Method Details
#modal_body(options = {}, escape = true, &block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/helpers/bootstrap_rails_helpers/modal_helper.rb', line 29 def modal_body( = {}, escape = true, &block) = { :class => 'modal-body' } render :layout => 'bootstrap_rails_helpers/modal_body', :locals => { options: .merge(), escape: escape }, &block end |
#modal_cancel_button(content, options = {}) ⇒ Object
56 57 58 59 |
# File 'app/helpers/bootstrap_rails_helpers/modal_helper.rb', line 56 def content, = {} = { :class => "btn bootstrap-modal-cancel-button", :data => { dismiss: "modal" }, :aria => { hidden: 'true' }} content_tag_string "a", content, .merge() end |
#modal_dialog(options = {}, escape = true, &block) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/bootstrap_rails_helpers/modal_helper.rb', line 3 def modal_dialog( = {}, escape = true, &block) = { :class => 'modal hide fade' } render :layout => 'bootstrap_rails_helpers/modal_dialog', :locals => { options: .merge(), escape: escape }, &block end |
#modal_footer(options = {}, escape = true, &block) ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/helpers/bootstrap_rails_helpers/modal_helper.rb', line 37 def ( = {}, escape = true, &block) = { :class => 'modal-footer' } render :layout => 'bootstrap_rails_helpers/modal_footer', :locals => { options: .merge(), escape: escape }, &block end |
#modal_header(content_or_options_with_block = nil, options = {}, escape = true, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/bootstrap_rails_helpers/modal_helper.rb', line 11 def modal_header( = nil, = {}, escape = true, &block) = { :class => 'modal-header' } if block_given? = if .is_a?(Hash) render :layout => 'bootstrap_rails_helpers/modal_header', :locals => { options: .merge(), escape: escape }, &block else render :layout => 'bootstrap_rails_helpers/modal_header', :locals => { options: .merge(), escape: escape } do content_tag :h3, end end end |
#modal_toggle(content_or_options = {}, options = {}, &block) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/bootstrap_rails_helpers/modal_helper.rb', line 45 def modal_toggle( = {}, = {}, &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 |