Module: LotusAdmin::PanelHelpers

Defined in:
app/helpers/lotus_admin/panel_helpers.rb

Instance Method Summary collapse

Instance Method Details

#boolean_tag(bool) ⇒ Object



18
19
20
21
22
# File 'app/helpers/lotus_admin/panel_helpers.rb', line 18

def boolean_tag(bool)
  return (:span, 'Yes', class: 'label label-success') if bool

  (:span, 'No', class: 'label label-danger')
end

#panel_attribute(resource, attribute, &block) ⇒ Object



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

def panel_attribute(resource, attribute, &block)
  (:div, class: 'list-group-item') do
    (:div, class: 'lgi-heading m-b-5') do
      resource.class.human_attribute_name(attribute)
    end +
    (:div, class: 'lgi-text') do
      if block_given?
        capture_haml(&block)
      else
        resource.public_send(attribute).to_s
      end
    end
  end
end