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, #html_title

Instance Method Details

#attributes_table(*args, &block) ⇒ Object


27
28
29
30
31
32
33
34
35
36
37
# File 'lib/active_admin/views/pages/show.rb', line 27

def attributes_table(*args, &block)
  opts = args.extract_options!
  table_title = if opts.has_key?(:title)
                  render_or_call_method_or_proc_on(resource, opts[:title])
                else
                  ActiveAdmin::Localizers.resource(active_admin_config).t(:details)
                end
  panel(table_title) 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)


41
42
43
44
45
46
47
48
49
# File 'lib/active_admin/views/pages/show.rb', line 41

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