Skip to content

Instantly share code, notes, and snippets.

@bonyiii
Created April 8, 2014 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bonyiii/10180721 to your computer and use it in GitHub Desktop.
Save bonyiii/10180721 to your computer and use it in GitHub Desktop.
class MyApp.CarsController extends Batman.ApplicationController
# Appears to work the same way MyApp.CarsIndexView#viewDidAppear
@afterAction only: "index", ->
$('table').dataTable()
index: (params) ->
@set('cars', MyApp.Car.get('all'))
%h1= t('cars.list')
%table#cars.listing.datatable
%thead
%tr
%th= Car.human_attribute_name("name")
%th= Car.human_attribute_name("model")
%th
%tbody
%tr{ "data-foreach-car" => "cars" }
%td
%a{ "data-bind" => "car.name", "data-route" => "car" }
%td{ "data-bind" => "car.name" }
%td{ "data-bind" => "car.model" }
%td
%a{"data-event-click" => "destroy"}
= t('Destroy')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment