Sha256: 604e42dc93bb3e5e0e2983344b02a4ff5f5810c27a08def6224dd73bdf3718fe

Contents?: true

Size: 1.65 KB

Versions: 11

Compression:

Stored size: 1.65 KB

Contents

---
redirect_from: /docs/6-show-pages.html
---
# Customize the Show Page

The show block is rendered within the context of the view and uses
[Arbre](https://github.com/activeadmin/arbre) syntax.

With the `show` block, you can render anything you want.

```ruby
ActiveAdmin.register Post do
  show do
    h3 post.title
    div do
      simple_format post.body
    end
  end
end
```

You can render a partial at any point:

```ruby
ActiveAdmin.register Post do
  show do
    # renders app/views/admin/posts/_some_partial.html.erb
    render 'some_partial', { post: post }
  end
end
```

If you'd like to keep the default AA look, you can use `attributes_table`:

```ruby
ActiveAdmin.register Ad do
  show do
    attributes_table do
      row :title
      row :image do |ad|
        image_tag ad.image.url
      end
    end
    active_admin_comments
  end
end
```

You can also customize the title of the object in the show screen:

```ruby
show title: :name do
  # ...
end
```

If you want a more data-dense page, you can combine a sidebar:

```ruby
ActiveAdmin.register Book do
  show do
    panel "Table of Contents" do
      table_for book.chapters do
        column :number
        column :title
        column :page
      end
    end
    active_admin_comments
  end

  sidebar "Details", only: :show do
    attributes_table_for book do
      row :title
      row :author
      row :publisher
      row('Published?') { |b| status_tag b.published? }
    end
  end
end
```

If you want to keep the default show data, but add something extra to it:

```ruby
show do
  div do
    h3 'Some custom charts about this object'
    render partial: 'charts'
  end
  default_main_content
end
```

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
activeadmin-2.13.1 docs/6-show-pages.md
activeadmin-2.13.0 docs/6-show-pages.md
activeadmin-2.12.0 docs/6-show-pages.md
activeadmin-2.11.2 docs/6-show-pages.md
activeadmin-2.11.1 docs/6-show-pages.md
activeadmin-2.11.0 docs/6-show-pages.md
activeadmin-2.10.1 docs/6-show-pages.md
activeadmin-2.10.0 docs/6-show-pages.md
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/docs/6-show-pages.md
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/docs/6-show-pages.md
activeadmin-2.9.0 docs/6-show-pages.md