gregbell/active_admin — pull request #1554 by watson (2012-07-25 00:09:35+00:00)
Title: Add new custom index page: Index as a Calendar

Sometimes you want to display the index screen for a set of resources as a calendar. To do so, use the :calendar option for the index block.

```ruby
index :as => :calendar
```

The calendar is useful for instance if you have a blog post resource and want to view them on the day they where written. Here is an example where I use it in my own project:

![screenshot](https://dl.dropbox.com/u/1532339/assets/Screen%20Shot%202012-07-25%20at%2002.05.56.png)

By default resources will be groups by their `updated_at` attribute. But if you need to, you can specify another attribute to group by using the `:group_by` argument:

```ruby
index :as => :calendar, :group_by => :published_at
```

The `index` method expects a block. The block will be yielded once for each day in the active month. The block will be parsed two arguments: The current date and an array of resource objects that is related to that date (grouped by the `:group_by` option described above).

```ruby
index :as => :calendar, :group_by => :published_at do |date, posts|
ul do
posts.each do |post|
li link_to(post.title, edit_resource_path(post))
end
end
end
```

Of cause pagination doesn't makes sense when displaying the index as a calendar, so you should always use `config.pagiante = false` for the resource in question.