The master branch is compatible with rails 2.3. For Rails 2.2 compatibility, use the rails-2.2 branch.
This plugin enables those slicker-than-snot ajax drag-drop sortable elements on your active-scaffold page, with so little configuration you almost get it for free.
You’ll need the corresponding branch of ActiveScaffold to use this.
# rails 2.0 git clone git://github.com/activescaffold/active_scaffold_sortable.git vendor/plugins/active_scaffold_sortable
Create a model with a column named ‘position’:
# app/models/entry.rb # id integer # title string(255) # birthday date # position integer class Entry < ActiveRecord::Base end
Create your scaffold controller
# app/controllers/entries_controller.rb class EntryController < ApplicationController active_scaffold :entries do |config| config.actions << :sortable end end
and layout
# app/views/layouts/application.rhtml <html> <head> <title>active scaffold demo application</title> <%= javascript_include_tag :defaults %> <%= active_scaffold_includes %> </head> <body> <%= yield %> </body> </html>
If you’re using restful routes, append this to your route in routes.rb:
map.resources :tasks, :active_scaffold => true, :active_scaffold_sortable => true
If you’d like to use a different column name, put this line in your controller:
... active_scaffold :entries do |config| config.sortable.column = :position end ...
If you have issues installing the plugin, search / post to the "Active Scaffold ":http://groups.google.com/group/activescaffold forum or Create an issue
Fork, hack, push, and request a pull:
http://github.com/activescaffold/active_scaffold_sortable/
Contact me:
Tim Harper – irb(main):001:0> ( ‘tim_see_harperATgmail._see_om’.gsub(‘see’, ‘c’).gsub(‘AT’, ‘@’) )