Module: Trestle::PanelHelper

Defined in:
app/helpers/trestle/panel_helper.rb

Instance Method Summary collapse

Instance Method Details

#panel(options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/trestle/panel_helper.rb', line 3

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

  (:div, class: ["panel", html_class]) do
    if options[:title]
      concat (:div, options[:title], class: "panel-heading")
    end

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

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

#well(options = {}, &block) ⇒ Object



19
20
21
22
# File 'app/helpers/trestle/panel_helper.rb', line 19

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