Class: ActiveAdmin::Views::SidebarSection

Inherits:
Panel
  • Object
show all
Defined in:
lib/active_admin/views/components/sidebar_section.rb

Instance Method Summary collapse

Methods inherited from Panel

#add_child, #children?, #header_action

Instance Method Details

#attributes_table(*args, &block) ⇒ Object

Renders attributes_table_for current resource


18
19
20
# File 'lib/active_admin/views/components/sidebar_section.rb', line 18

def attributes_table(*args, &block)
  attributes_table_for resource, *args, &block
end

#build(section) ⇒ Object

Takes a ActiveAdmin::SidebarSection instance


9
10
11
12
13
14
15
# File 'lib/active_admin/views/components/sidebar_section.rb', line 9

def build(section)
  @section = section
  super(@section.title)
  add_class @section.custom_class if @section.custom_class
  self.id = @section.id
  build_sidebar_content
end

#build_sidebar_contentObject (protected)


24
25
26
27
28
29
30
31
# File 'lib/active_admin/views/components/sidebar_section.rb', line 24

def build_sidebar_content
  if @section.block
    rvalue = instance_exec(&@section.block)
    self << rvalue if rvalue.is_a?(String)
  else
    render(@section.partial_name)
  end
end