Class: ActiveAdmin::Views::Pages::Show

Inherits:
Base show all
Includes:
DefaultMainContent
Defined in:
lib/active_admin/views/pages/show.rb

Defined Under Namespace

Modules: DefaultMainContent

Instance Attribute Summary

Attributes inherited from Arbre::HTML::Tag

#attributes

Attributes inherited from Arbre::HTML::Element

#children, #parent

Instance Method Summary collapse

Methods included from DefaultMainContent

#default_attribute_table_rows, #default_main_content

Methods inherited from Base

#build

Methods inherited from Arbre::HTML::Document

#build, #build_body, #build_head, #doctype, #document, #tag_name, #to_s

Methods inherited from Arbre::HTML::Tag

#add_class, #build, #class_list, #class_names, #get_attribute, #has_attribute?, #id, #id!, #id=, #initialize, #remove_attribute, #remove_class, #set_attribute, #to_s

Methods inherited from Arbre::HTML::Element

#+, #<<, #add_child, #assigns, #build, builder_method, #content, #content=, #document, #each, #get_elements_by_class_name, #get_elements_by_tag_name, #helpers, #html_safe, #indent_level, #initialize, #parent?, #remove_child, #tag_name, #to_ary, #to_s, #to_str

Methods included from Arbre::Builder::BuilderMethods

#append_return_block, #build_tag, #current_dom_context, #insert_tag, #with_current_dom_context

Methods included from Arbre::Builder

#current_dom_context, #helpers, #method_missing

Constructor Details

This class inherits a constructor from Arbre::HTML::Tag

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Arbre::Builder

Instance Method Details

#attributes_table(*args, &block) ⇒ Object



30
31
32
33
34
# File 'lib/active_admin/views/pages/show.rb', line 30

def attributes_table(*args, &block)
  panel(I18n.t('active_admin.details', :model => active_admin_config.resource_name)) do
    attributes_table_for resource, *args, &block
  end
end

#configObject



6
7
8
# File 'lib/active_admin/views/pages/show.rb', line 6

def config
  active_admin_config.get_page_presenter(:show) || ::ActiveAdmin::PagePresenter.new
end

#default_titleObject (protected)



38
39
40
# File 'lib/active_admin/views/pages/show.rb', line 38

def default_title
  "#{active_admin_config.resource_name} ##{resource.id}"
end

#main_contentObject



21
22
23
24
25
26
27
28
# File 'lib/active_admin/views/pages/show.rb', line 21

def main_content
  if config.block
    # Eval the show config from the controller
    instance_exec resource, &config.block
  else
    default_main_content
  end
end

#titleObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/active_admin/views/pages/show.rb', line 10

def title
  case config[:title]
  when Symbol, Proc
    call_method_or_proc_on(resource, config[:title])
  when String
    config[:title]
  else
    default_title
  end
end