Module: ModalHelper

Defined in:
app/helpers/modal_helper.rb

Instance Method Summary collapse

Instance Method Details



14
15
16
17
# File 'app/helpers/modal_helper.rb', line 14

def modal_body(options = {}, escape = true, &block)
  default_options = { class: 'modal-body' }
   :div, nil, options.merge(default_options), escape, &block
end


36
37
38
39
40
# File 'app/helpers/modal_helper.rb', line 36

def modal_cancel_button(content, options = {})
  default_options = { class: 'btn bootstrap-modal-cancel-button' }

   'a', content, default_options.merge(options)
end


2
3
4
5
# File 'app/helpers/modal_helper.rb', line 2

def modal_dialog(options = {}, escape = true, &block)
  default_options = { class: 'bootstrap-modal modal' }
   :div, nil, options.merge(default_options), escape, &block
end


19
20
21
22
# File 'app/helpers/modal_helper.rb', line 19

def modal_footer(options = {}, escape = true, &block)
  default_options = { class: 'modal-footer' }
   :div, nil, options.merge(default_options), escape, &block
end


7
8
9
10
11
12
# File 'app/helpers/modal_helper.rb', line 7

def modal_header(options = {}, escape = true, &block)
  default_options = { class: 'modal-header' }
   :div, nil, options.merge(default_options), escape do
    raw('<button class="close" data-dismiss="modal">&times;</button>' + capture(&block))
  end
end


24
25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/modal_helper.rb', line 24

def modal_toggle(content_or_options = nil, options = {}, &block)
  if block_given?
    options = content_or_options if content_or_options.is_a?(Hash)
    default_options = { :class => 'btn', 'data-toggle' => 'modal', 'href' => options[:dialog] }.merge(options)

     :a, nil, default_options, true, &block
  else
    default_options = { :class => 'btn', 'data-toggle' => 'modal', 'href' => options[:dialog] }.merge(options)
     :a, content_or_options, default_options, true
  end
end