Skip to content

Instantly share code, notes, and snippets.

@xsurge83
Created March 21, 2012 12:55
Show Gist options
  • Save xsurge83/2146711 to your computer and use it in GitHub Desktop.
Save xsurge83/2146711 to your computer and use it in GitHub Desktop.
Batmanjs Todo Controller
class TodosController extends Batman.Controller
index: () ->
@set('todo', new Todo())
@render(false)
create: () =>
@todo.save(() => @set('todo', new Todo))
# clean checked todo items.
clean: () ->
todos = TodoApp.get('Todo.all')
todos.filter (todo) ->
if todo.get('IsDone')
todo.destroy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment