Sha256: e2cd5a18f9ea8b18cd7251d2f72cee73e2f327164677a75bdb7e8a41f52c950a

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

# Customize the Show Page

The show block is rendered within the context of the view and uses [Arbre](https://github.com/gregbell/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'
  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
        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? ? 'Yes' : 'No' }
    end
  end
end
```

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
yousty-activeadmin-1.0.4.pre docs/6-show-pages.md
yousty-activeadmin-1.0.3.pre docs/6-show-pages.md
active_administration-0.0.3 docs/6-show-pages.md
activeadministration-0.0.2 docs/6-show-pages.md
active_administration-0.0.2 docs/6-show-pages.md
activeadministration-0.0.1 docs/6-show-pages.md
active_administration-0.0.1 docs/6-show-pages.md
yousty-activeadmin-1.0.2.pre docs/6-show-pages.md
yousty-activeadmin-1.0.1.pre docs/6-show-pages.md
yousty-activeadmin-1.0.0.pre docs/6-show-pages.md