robotex82 / active_admin-acts_as_list

Acts as list helper for active admin
MIT License
7 stars 12 forks source link

= ActiveAdminActsAsList

= Purpose

Add sortable columns for active admin.

= Features

= 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

= License

This project rocks and uses MIT-LICENSE.