Skip to content

wanglian/table_header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TableHeader
===============

Enhance HTML tables in rails app.
This plugin must be used together with 'sortable_table' plugin.

Install
=======
script/plugin install git://github.com/wanglian/table_header.git

In app/controllers/application_controller.rb:

    class ApplicationController < ActionController::Base
      include SortableTable::App::Controllers::ApplicationController
      include TableHeader::App::Controllers::ApplicationController
    end

In app/helpers/application_helper.rb:

    module ApplicationHelper
      include SortableTable::App::Helpers::ApplicationHelper
      include TableHeader::App::Helpers::ApplicationHelper
    end


Controller
==========
Use the selectable_attributes macro to list the... selectable attributes.
Use the filter_attributes macro to list the... filter attributes.

Then, in your index action, pass the conditions method.

    class UsersController < Admin::BaseController
      selectable_attributes :gender
      filter_attributes :name, :email
      
      def index
        @users = User.paginate :conditions => header_conditions, 
                               :page => params[:page], :order => sort_order
      end
    end

View
====
Add some sugar for your views:
  <%= sortable_table_header :name => "#{order_image('id')}ID", :sort => "id" %>
  <%= selectable_table_header :select => "gender", :collection => ['Male', 'Female'] %>
  <td><%= filter_table_header("name", :size => 10) %></td>


Demo
=======
http://table-header.heroku.com


Copyright (c) 2009 [Allen Wang], released under the MIT license

About

Enhance HTML tables in rails app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages