chaplinjs/chaplin — pull request #112 by mdp (2012-06-16 01:29:21+00:00)
Title: Save current controller before calling it

I ran into this recently.

Let say I have a controller action like this

class Books extend ChaplinController

show: ->
unless loggedIn
Backbone.history.navigate('/', true)
else
Do something

The Dispatcher will call show, it'll call Backbone.history.navigate, the new controller will be instantiated and the action called. [Dispatch]currentController will still be null, so the Books controller won't get disposed even though you navigated away from it.

Or maybe there's a better way to force the navigation that I'm just missing