Sha256: 94501c9e0ace514362f16d8dc14a911d9aecf9be12f03b06334256db4169f190

Contents?: true

Size: 1.55 KB

Versions: 64

Compression:

Stored size: 1.55 KB

Contents

<!-- Please don't edit this file. It will be clobbered. -->

# Index as Blog

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

    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:

    index :as => :blog do
      title :a_method_to_call
    end

This will result in the title of the post being the return value of
Resource#a_method_to_call

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:

    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:

    index :as => :blog do
      title :my_title
      body :my_body # Return value of #my_body will be the body
    end

Or, render a block as the body:

    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

64 entries across 64 versions & 3 rubygems

Version Path
lalala-4.0.0.dev.94 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.92 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.90 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.84 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.80 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.79 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.78 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.77 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.74 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.73 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.72 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.71 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.66 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.65 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
activeadmin-0.6.0 docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.64 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.63 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.62 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.61 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md
lalala-4.0.0.dev.60 vendor/deps/active_admin/docs/3-index-pages/index-as-blog.md