Skip to content

Instantly share code, notes, and snippets.

@sishen
Created August 16, 2012 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sishen/3370398 to your computer and use it in GitHub Desktop.
Save sishen/3370398 to your computer and use it in GitHub Desktop.
Sample Spine.js Routing Controller in Pragmatic.ly
class App.TicketsController extends Spine.Controller
constructor: ->
super
@routes
"/tickets": @index
"/tickets/:id" : (params) ->
@show(params.id)
index: ->
tickets = App.Ticket.all()
App.Ticket.trigger "tickets:index", tickets
show: (id) ->
ticket = App.Ticket.find(id)
$.publish 'ticket:switch', ticket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment