Sha256: 6900c80eb0def38f83a97fc30ff3e04f8a0705a75f9834619c7e0e627e9159c4

Contents?: true

Size: 1.44 KB

Versions: 35

Compression:

Stored size: 1.44 KB

Contents

<!--
  WARNING: Please DO NOT edit this file! Update
  source documentation in lib/active_admin/views
  and execute rake yard to regenerate it.
-->

# Index as Blog

Render your index page as a set of posts. The post has two main options:
title and body.

```ruby
index as: :blog do
  title :my_title # Calls #my_title on each resource
  body  :my_body  # Calls #my_body on each resource
end
```

## Post Title

The title is the content that will be rendered within a link to the
resource. There are two main ways to set the content for the title

First, you can pass in a method to be called on your resource. For example:

```ruby
index as: :blog do
  title :a_method_to_call
end
```

Second, you can pass a block to the tile option which will then be
used as the contents fo the title. The resource being rendered
is passed in to the block. For Example:

```ruby
index as: :blog do
  title do |post|
    span post.title,      class: 'title'
    span post.created_at, class: 'created_at'
  end
end
```

## Post Body

The body is rendered underneath the title of each post. The same two
style of options work as the Post Title above.

Call a method on the resource as the body:

```ruby
index as: :blog do
  title :my_title
  body :my_body
end
```

Or, render a block as the body:

```ruby
index as: :blog do
  title :my_title
  body do |post|
    div truncate post.title
    div class: 'meta' do
      span "Post in #{post.categories.join(', ')}"
    end
  end
end
```

Version data entries

35 entries across 35 versions & 6 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/docs/3-index-pages/index-as-blog.md
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.17.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.16.pre docs/3-index-pages/index-as-blog.md
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/docs/3-index-pages/index-as-blog.md
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/docs/3-index-pages/index-as-blog.md
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.15.pre docs/3-index-pages/index-as-blog.md
activeadmin-orac-1.0.0.pre4 docs/3-index-pages/index-as-blog.md
activeadmin-orac-1.0.0 docs/3-index-pages/index-as-blog.md
activeadmin-orac-1.0.0.pre.orac docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.14.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.13.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.12.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.11.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.10.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.9.pre docs/3-index-pages/index-as-blog.md
yousty-activeadmin-1.0.8.pre docs/3-index-pages/index-as-blog.md
activeadmin-1.0.0.pre4 docs/3-index-pages/index-as-blog.md
activeadmin-1.0.0.pre3 docs/3-index-pages/index-as-blog.md