gem 'livelist', '0.0.2'
then:
bundle install
$(document).ready ->
list = new LiveList(
global:
resourceName: 'users'
resourceNameSingular: 'user'
list:
renderTo: 'ul#users'
listItemTemplate: '<li>{{first_name}} {{last_name}} ({{status}})</li>'
filters:
renderTo: 'div#filters'
pagination:
renderTo: 'div#pagination'
)
//= require livelist-rails
//= require users
<%= javascript_include_tag 'application' %>
def index
@users = User.filter(params[:filters])
@filters = User.filters_as_json(params[:filters])
end
object false
node :pagination do
@pagination
end
node :filters do
@filters
end
child(@users) do
extends('users/user')
end
object @user
attributes :first_name, :last_name, :status
class User < ActiveRecord::Base
filters :status
end