Sha256: e98439c02fabe369892af86c9fb57feafe9594fc017dec176c714cb324b015b7

Contents?: true

Size: 1.01 KB

Versions: 14

Compression:

Stored size: 1.01 KB

Contents

module Binco
  module ModalHelper
    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

    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

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

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
binco-3.2.0 app/helpers/binco/modal_helper.rb
binco-2.0.1 app/helpers/binco/modal_helper.rb
binco-3.1.6 app/helpers/binco/modal_helper.rb
binco-3.1.5 app/helpers/binco/modal_helper.rb
binco-3.1.4 app/helpers/binco/modal_helper.rb
binco-3.1.3 app/helpers/binco/modal_helper.rb
binco-3.1.2 app/helpers/binco/modal_helper.rb
binco-3.1.1 app/helpers/binco/modal_helper.rb
binco-3.1.0 app/helpers/binco/modal_helper.rb
binco-3.0.2 app/helpers/binco/modal_helper.rb
binco-3.0.1 app/helpers/binco/modal_helper.rb
binco-0.0.3 app/helpers/binco/modal_helper.rb
binco-0.0.2 app/helpers/binco/modal_helper.rb
binco-0.0.1 app/helpers/binco/modal_helper.rb