Class: ActiveAdmin::Views::Panel

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin/views/components/panel.rb

Instance Method Summary collapse

Instance Method Details

#add_child(child) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/active_admin/views/components/panel.rb', line 16

def add_child(child)
  if @contents
    @contents << child
  else
    super
  end
end

#build(title, attributes = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/active_admin/views/components/panel.rb', line 7

def build(title, attributes = {})
  icon_name = attributes.delete(:icon)
  icn = icon_name ? icon(icon_name) : "".html_safe
  super(attributes)
  add_class "panel"
  @title = h3(icn + title.to_s)
  @contents = div(:class => "panel_contents")
end

#children?Boolean

Override children? to only report children when the panel’s contents have been added to. This ensures that the panel correcly appends string values, etc.

Returns:

  • (Boolean)


27
28
29
# File 'lib/active_admin/views/components/panel.rb', line 27

def children?
  @contents.children?
end