0.02
No commit activity in last 3 years
No release in over 3 years
RailsAdminGrid is a custom action for RailsAdmin that displays objects in a grid with thumbnails. It provides an alternative to the default list view provided in RailsAdmin.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.0.0
~> 0.8.0
 Project Readme

RailsAdminGrid

Gem Version

RailsAdminGrid is a custom collection action for RailsAdmin that displays objects in a grid with thumbnails. It provides an alternative to the default list view provided in RailsAdmin.

Preview

alt tag

Installation

Add the following to your Gemfile before rails_admin:

gem 'rails_admin_grid'

Configuration

Global

You must add the custom action to the list of actions in your global RailsAdmin configuration. The default, with RailsAdminGrid added, looks like this:

# config/initializers/rails_admin.rb
RailsAdmin.config do |config|
  config.actions do
    # root actions
    dashboard                     # mandatory
    # collection actions 
    index                         # mandatory
    new
    export
    history_index
    bulk_delete
    # member actions
    show
    edit
    delete
    history_show
    show_in_app

    grid                          # RailsAdminGrid
  end
end

Since RailsAdminGrid works best for displaying models with an associated picture, it may not be desirable to use on every model. You can restrict the models for which the action is available using the steps described here.

Model

To configure RailsAdminGrid's behavior on a specific model, you must include a grid block in your model configuration, as such:

rails_admin do
  grid do
    thumbnail_method do
      :thumb
    end
  end
end

The only information RailsAdmin requires to function properly is a thumbnail_method, a method which it will use to retrieve the corresponding thumbnail for the object. Visible fields and copes can also be configured in this block.

These properties must be specified in the list block instead of the grid block:

  • items_per_page
  • sort_reverse
  • sort_by