Sha256: c358f868380141e0e57f4c8860c7375c8eda92ac53cfabdb476bd2ec40a152f6

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

module Trestle
  module PanelHelper
    def panel(options={}, &block)
      html_class = options.fetch(:class) { "panel-default" }

      content_tag(:div, options.slice(:id, :data).merge(class: ["panel", html_class])) do
        if options[:title]
          concat content_tag(:div, options[:title], class: "panel-heading")
        end

        concat content_tag(:div, class: "panel-body", &block)

        if options[:footer]
          concat content_tag(:div, options[:footer], class: "panel-footer")
        end
      end
    end

    def well(options={}, &block)
      html_class = ["well", options[:class]].compact
      content_tag(:div, options.merge(class: html_class), &block)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trestle-0.8.13 app/helpers/trestle/panel_helper.rb
trestle-0.8.12 app/helpers/trestle/panel_helper.rb