Module: BootstrapComponentsHelpers::ModalHelper
- Defined in:
- lib/bootstrap-components-helpers/modal_helper.rb
Defined Under Namespace
Classes: ModalBuilder
Instance Method Summary collapse
Instance Method Details
#modal(title, options = {}) {|builder| ... } ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bootstrap-components-helpers/modal_helper.rb', line 5 def modal title, = {} builder = ModalBuilder.new self yield builder 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 header = content_tag :div, class: 'modal-header' do content_tag(:a, '×', class: 'close', data: {dismiss: 'modal'}) + content_tag(:h4, title, class: 'modal-title') end body = content_tag(:div, class: 'modal-body') {builder.body_content} unless [:skip_footer] = content_tag(:div, class: 'modal-footer') do builder. || content_tag(:a, 'Cancel', class: 'btn pull-right', data: {dismiss: 'modal'}) end end header + body + end end end end |