Sha256: 6543f0120a3c58a00daf36ee5f8b2334c06fff540a9a1def7bec8a8a17dd9b3a

Contents?: true

Size: 1.01 KB

Versions: 8

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

        "#{title}#{close}".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

8 entries across 8 versions & 1 rubygems

Version Path
binco-4.0.0 app/helpers/binco/modal_helper.rb
binco-3.5.4 app/helpers/binco/modal_helper.rb
binco-3.5.2 app/helpers/binco/modal_helper.rb
binco-3.5.1 app/helpers/binco/modal_helper.rb
binco-3.5.0 app/helpers/binco/modal_helper.rb
binco-3.4.0 app/helpers/binco/modal_helper.rb
binco-3.3.0 app/helpers/binco/modal_helper.rb
binco-3.2.1 app/helpers/binco/modal_helper.rb