Class: ActiveAdmin::Views::SidebarSection

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

Instance Method Summary collapse

Instance Method Details

#attributes_table(*args, &block) ⇒ Object

Renders attributes_table_for current resource



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

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
# File 'lib/active_admin/views/components/sidebar_section.rb', line 9

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

#build_sidebar_contentObject (protected)



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

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