Created
August 16, 2012 14:16
-
-
Save sishen/3370398 to your computer and use it in GitHub Desktop.
Sample Spine.js Routing Controller in Pragmatic.ly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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