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

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

Defined Under Namespace

Modules: DefaultMainContent

Instance Method Summary collapse

Methods included from DefaultMainContent

#default_attribute_table_rows, #default_main_content

Methods inherited from Base

#build

Instance Method Details

#attributes_table(*args, &block) ⇒ Object


27
28
29
30
31
# File 'lib/active_admin/views/pages/show.rb', line 27

def attributes_table(*args, &block)
  panel(I18n.t('active_admin.details', model: active_admin_config.resource_label)) 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) || super
end

#default_titleObject (protected)


35
36
37
38
39
40
41
42
43
# File 'lib/active_admin/views/pages/show.rb', line 35

def default_title
  title = display_name(resource)

  if title.blank?
    title = "#{active_admin_config.resource_label} ##{resource.id}"
  end

  title
end

#main_contentObject


18
19
20
21
22
23
24
25
# File 'lib/active_admin/views/pages/show.rb', line 18

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
# File 'lib/active_admin/views/pages/show.rb', line 10

def title
  if config[:title]
    render_or_call_method_or_proc_on(resource, config[:title])
  else
    assigns[:page_title] || default_title
  end
end