Drop in support for one click sorting of your model's columns.
Ruby
Pull request Compare This branch is 4 commits behind dlabare:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

SortableColumns
===============

A drop plugin for creating headers to easily sort a listing by any of it's columns.


Example
=======

./script/plugin install git://github.com/dlabare/sortable_columns.git

1) Add the sortable order to your .find, or .paginate

def index
  @blobs = Blob.all(:order => sortable_order(Blob))
end

2) Add the header links when listing your blobs.

<table>
  <tr>
    <th><%= link_to 'Name', sort_params(Blob, :name) %></th>
    <th><%= link_to 'Rank', sort_params(Blob, :rank) %></th>
  </tr>

  <% @blobs.each do |blob| %>
  <tr>
    <td><%= blob.name %></td>
    <td><%= blob.rank %></td>
  </tr>
  <% end %>
</table>

3) Profit.




Copyright (c) 2009 Daniel LaBare, released under the MIT license