tabulatr2 – index tables for lazy people

13
tabulatr2 Index Pages for Lazy People… Florian Thomas [email protected] @crunch09 Peter Horn [email protected] @n0dashes Lightning Talk Oct 3rd 2014

Upload: peter-horn

Post on 24-Jun-2015

152 views

Category:

Presentations & Public Speaking


7 download

DESCRIPTION

a brief wrapup about the ruby gem tabulatr2

TRANSCRIPT

Page 1: tabulatr2 – Index Tables for Lazy People

tabulatr2Index Pages for Lazy People…

Florian Thomas [email protected]

@crunch09

Peter Horn [email protected]

@n0dashes

Lightning Talk Oct 3rd 2014

Page 2: tabulatr2 – Index Tables for Lazy People
Page 3: tabulatr2 – Index Tables for Lazy People

tr th Firstname th Lastname th Balance @customers.each do |customer| tr td= customer.firstname td= customer.lastname td= customer.balance

index.html.slim

simple ‘nuf

def index @customers = Customer.all end

Classic Index Page

customer_controller.rb

Page 4: tabulatr2 – Index Tables for Lazy People

tr th Firstname th Lastname th Balance @customers.each do |customer| tr td= customer.firstname td= customer.lastname td= customer.balance

index.html.slim

simple ‘nuf

def index @customers = Customer.all end

Classic Index Page

customer_controller.rbLovely!

Just quickly add

• Pagination

• Filtering

• Sorting

• Searching

• Batch Actions

…and we’re done.

Page 5: tabulatr2 – Index Tables for Lazy People

tr th Firstname th Lastname th Balance @customers.each do |customer| tr td= customer.firstname td= customer.lastname td= customer.balance

index.html.slim

simple ‘nuf

def index @customers = Customer.all end

Classic Index Page

customer_controller.rbLovely!

Just quickly add

• Pagination

• Filtering

• Sorting

• Searching

• Batch Actions

…and we’re done.

Page 6: tabulatr2 – Index Tables for Lazy People

That can’t be!

• ActiveRecord is so simple (and even adequate)

• SimpleForm is so simple!

Why need tables to be such a hazzle?

Page 7: tabulatr2 – Index Tables for Lazy People

That can’t be!

• ActiveRecord is so simple (and even adequate)

• SimpleForm is so simple!

Why need tables to be such a hazzle?

Because a friggin’ lot of stuff

is involved.

…but now …there’s tabulatr2!

Page 8: tabulatr2 – Index Tables for Lazy People

= table_for Customer

index.html.slim

def index tabulatr_for Customer end

Tabulatr Index Page

customer_controller.rb

class CustomerTabulatrData < Tabulatr::Data ! search :firstname, :lastname column :firstname column :lastname column :balance, format: :currency, align: :right end

customer_tabulatr_data.rb

Page 9: tabulatr2 – Index Tables for Lazy People

= table_for Customer

index.html.slim

def index tabulatr_for Customer end

Tabulatr Index Page

customer_controller.rb

class CustomerTabulatrData < Tabulatr::Data ! search :firstname, :lastname column :firstname column :lastname column :balance, format: :currency, align: :right end

customer_tabulatr_data.rb

Page 10: tabulatr2 – Index Tables for Lazy People

There’s so much more• All data is fetched via ajax

• Custom SQL for sorting, filtering, sorting, no N + 1

• Tables are (by default) stateful

• Infinite scrolling, if you so wish

• Shortcuts to create ‘action’ buttons

• Support for static tables (non-ajax)

• Batch actions

• …

Page 11: tabulatr2 – Index Tables for Lazy People

How Does That Work?

(rough concept only)

Controller

Renderer

DSL

Javascript

View

TabulatrData

Page 12: tabulatr2 – Index Tables for Lazy People

122.54% Cooler!*

✴ Based on a study with 4 developers that took place between October 1st and October 2rd 2014 in some pubs in Ghent. There definitely was too much alcohol involved, and the number is made up anyway, but things look so much more professional with a footnote.

Page 13: tabulatr2 – Index Tables for Lazy People

github.com/provideal/tabulatr2

Sparklelord demands: Give it a try!

Talk to us!@n0dashes / no-dashes!@crunch09 / Crunch09