Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@MikeSilvis

This comment has been minimized.

Copy link

@MikeSilvis MikeSilvis commented May 31, 2012

what arguments go into here? @[value].active(arguments...)

And when do you ever call new SubStack to actually add the rendering to it.

My Gist: https://gist.github.com/2839845

@nvh

This comment has been minimized.

Copy link
Owner Author

@nvh nvh commented May 31, 2012

If you pass a function, it will be bound the the activate trigger, so it will be called when the controller is activated, if you don't pass it anything, it will activate the controller.

You subclass the substack controller, and initialize it the same way you would with a stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment