Sha256: 240a3f06e11a506f2ea12191fefa4cd6d3ab92d12be630a12586450add84e863

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

MagicGrid
=========

[![Build Status](https://secure.travis-ci.org/rmg/magic_grid.png?branch=master)](http://travis-ci.org/rmg/magic_grid)

Easy collection display grid with column sorting and pagination.

Displays a collection (ActiveRelation or Array) wrapped in an html table with server
side column sorting, filtering hooks, and search bar. Large collections can be
paginated with either the will_paginate gem or kaminari gem if you use them, or a naive
Enumerable based paginator (without pager links) if neither is present.

Tables are styled using Themeroller compatible classes, which also don't look _too_ bad
with Bootstrap.

Basic Usage
-----------

In your `Gemfile`:

    gem 'magic_grid'

In your view:

    <%= magic_grid(@posts, [:title, :author]) %>

Or a more realistic example:

```rhtml
<%= magic_grid(@posts, [:title, :author, "Actions"]) do |post| %>
  <tr>
    <td><%= link_to(post.title, post) %></td>
    <td><%= link_to(post.author, post.author) %></td>
    <td>
      <%= link_to("Edit", edit_post_path(post)) %> |
      <%= link_to("Delete", post, method: :delete,
                  data: {confirm: "Are you sure?"}) %>
    </td>
  </tr>
<% end %>
```

Development
-----------

Testing was originally done UnitTest style, with some tarantula to force a
bunch of random page renderings. I've since added some RSpec goodness.

To run all the tests, just run `rake`.

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
magic_grid-0.11.1 README.md
magic_grid-0.11.0 README.md
magic_grid-0.10.4 README.md
magic_grid-0.10.3 README.md
magic_grid-0.10.2 README.md
magic_grid-0.10.1 README.md