ActiveAdminActsAsList

Purpose

Add sortable columns for active admin.

Features

  • Add member actions with one method call
  • Add sorting columns in your index views with one method call.
  • Integrates with acts_as_list

Prerequisites

You need active_admin and acts_as_list.

Installation

Add it to your gemfile:

gem 'active_admin-acts_as_list'

Install your bundle:

> bundle install

Usage

Assuming you have a Players model:

class Player < ActiveRecord::Base
# acts as list
acts_as_list
default_scope :order => 'position ASC'

#...
end

You can add sortable columns, member actions and sorting like this:

#app/admin/players.rb
ActiveAdmin.register Player do
# Sort players by position
config.sort_order = 'position'

# Add member actions for positioning.
sortable_member_actions

index do
  # This adds columns for moving up, down, top and bottom.
  sortable_columns
  
  #...
  column :firstname
  column :lastname
  default_actions
end
end

Todo

  • Tests, tests, tests.
  • Better docs.

License

This project rocks and uses MIT-LICENSE.