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 |
This comment has been minimized.
This comment has been minimized.
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
This comment has been minimized.
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