Module: Binco::ModalHelper
- Defined in:
- app/helpers/binco/modal_helper.rb
Instance Method Summary collapse
- #modal(id, &block) ⇒ Object
- #modal_body(options = {}, &block) ⇒ Object
- #modal_footer(&block) ⇒ Object
- #modal_header(title = nil, &block) ⇒ Object
Instance Method Details
#modal(id, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/binco/modal_helper.rb', line 3 def modal(id, &block) content_tag :div, class: 'modal fade', tabindex: '-1', id: id do content_tag :div, class: 'modal-dialog' do content_tag :div, class: 'modal-content' do yield end end end end |
#modal_body(options = {}, &block) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/helpers/binco/modal_helper.rb', line 28 def modal_body( = {}, &block) [:class] ||= 'modal-body' [:class] << ' modal-body' content_tag :div, do yield end end |
#modal_footer(&block) ⇒ Object
36 37 38 39 40 |
# File 'app/helpers/binco/modal_helper.rb', line 36 def (&block) content_tag :div, class: 'modal-footer' do yield end end |
#modal_header(title = nil, &block) ⇒ Object
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) content_tag :div, class: 'modal-header' do close = content_tag :button, class: 'close' do content_tag(:span, '×'.html_safe, data: { dismiss: 'modal' } ) end if block_given? title = yield else title = content_tag(:h4 , title, class: 'modal-title') end "#{title}#{close}".html_safe end end |