Module: ModalHelper

Includes:
ActionView::Helpers, FormatHelper
Defined in:
app/helpers/modal_helper.rb

Instance Method Summary collapse

Methods included from FormatHelper

#parse_content_or_options, #prepend_class, #squeeze_n_strip

Instance Method Details



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/modal_helper.rb', line 5

def modal(options={}, &block)
  caption,
  button_options,
  modal_dialog_options,
  modal_content_options = parse_modal_options(options)

  ((button caption, button_options) +
    ( :div, options do
       :div, modal_dialog_options do
         :div, modal_content_options, &block
      end
    end)).html_safe
end


19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/modal_helper.rb', line 19

def modal_header(content_or_options=nil, options={}, &block)
  content, options = parse_content_or_options(content_or_options, options)

  title_options = options.delete(:title_html) || {}
  prepend_class(options, 'modal-header')

  header_proc = block_given? ? block : proc { modal_title(content, title_options) }

   :div, options do
    render_close_btn + capture(&header_proc)
  end
end