Ordering plugin for rails_admin.
Add into your Gemfile
gem 'rails_admin_ordering', :git => 'git://github.com/netcook/rails_admin_ordering.git'
run from console
rails g rails_admin_ordering:install
This should create migration file in your project
Add following line to your model:
class Article < ActiveRecord::Base
acts_as_ordering
end
Run migration to create all stuff
$ rake db:migrate
Edit config/initializers/rails_admin.rb and add orderup and orderdown actions.
config.actions do
# root actions
dashboard
# collection actions
index
new
bulk_delete
# member actions
show
edit
delete
# Set the custom action here
orderup
orderdown
end
Now to let RailsAdmin do valid order need to patch your model config. For example:
config.model Category do
list do
field :position do
sort_reverse false
sortable "orderings.position"
end
end
end
That's it!