Skip to content

davec/active_scaffold_sortable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drag-Drop Sortable for ActiveScaffold

Overview

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.

Installation

You’ll need at least ActiveScaffold 1.1.1 to use this, and probably rails 2.0

# rails 2.1
script/plugin install git://github.com/timcharper/active_scaffold_sortable.git

# rails 2.0
git clone git://github.com/timcharper/active_scaffold_sortable.git vendor/plugins/active_scaffold_sortable

Usage

Step 1

Create a model with a column called “position”:

# app/models/entry.rb

# id           integer
# title        string(255)
# birthday     date
# position     integer

class Entry < ActiveRecord::Base
end

Step 2

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>

Step 3

Hah! There is no step 3! Unless, of course, something goes wrong.

Notice:

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
...

Support

If you have issues installing the plugin, post to the Active Scaffold list.

Contributing

Fork, hack, push, and request a pull:

git://github.com/timcharper/active_scaffold_sortable.git

Author

Contact me:


Tim Harper – irb(main):001:0> ( ‘tim_see_harperATgmail._see_om’.gsub(‘see’, ‘c’).gsub(‘AT’, ‘@’) )

About

Fancy pants drag-drop sortable lists for ActiveScaffold (updated for Rails 2.3)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%