Skip to content

Instantly share code, notes, and snippets.

@twetzel
Forked from nvh/example_root.js.coffee
Created June 19, 2012 11:57
Show Gist options
  • Save twetzel/2953744 to your computer and use it in GitHub Desktop.
Save twetzel/2953744 to your computer and use it in GitHub Desktop.
Spine Substack
class App.Root extends Spine.Stack
controllers:
resources: App.Resources
users: App.Users
routes:
'/resources' : 'resources'
'/users' : 'users'
default: 'users'
className: 'stack root'
class App.Users extends Spine.SubStack
controllers:
search : Search
show : Show
profile : Profile
routes:
'/users/search' : 'search'
'/users/search?q=:query' : 'search'
'/users/profile' : 'profile'
'/users/:id' : 'show'
default: 'search'
className: 'stack users'
class Spine.SubStack extends Spine.Stack
constructor: ->
for key,value of @routes
do (key,value) =>
@routes[key] = =>
@active()
@[value].active(arguments...)
super
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment