gem 'livelist-rails', '0.0.3'
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' %>
if you are not already including mustache.js and underscore.min.js in your application layout, add the following:
<%= javascript_include_tag :livelist_dependencies %>
to include livelist.js or livelist.min.js (depending on your environment) add the following:
<%= javascript_include_tag :livelist %>
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