Module: Binco::ModalHelper

Defined in:
app/helpers/binco/modal_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
# File 'app/helpers/binco/modal_helper.rb', line 3

def modal(id, &block)
   :div, class: 'modal fade', tabindex: '-1', id: id do
     :div, class: 'modal-dialog' do
       :div, class: 'modal-content' do
        yield
      end
    end
  end
end


28
29
30
31
32
33
34
# File 'app/helpers/binco/modal_helper.rb', line 28

def modal_body(options = {}, &block)
  options[:class] ||= 'modal-body'
  options[:class] << ' modal-body'
   :div, options do
    yield
  end
end


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

def modal_footer(&block)
   :div, class: 'modal-footer' do
    yield
  end
end


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/binco/modal_helper.rb', line 13

def modal_header(title = nil, &block)
   :div, class: 'modal-header' do
    close =  :button, class: 'close' do
      (:span, '&times;'.html_safe, data: { dismiss: 'modal' } )
    end
    if block_given?
      title = yield
    else
      title = (:h4 , title, class: 'modal-title')
    end

    "#{title}#{close}".html_safe
  end
end