Skip to content

Instantly share code, notes, and snippets.

@machty
Last active December 15, 2015 21:50
Show Gist options
  • Select an option

  • Save machty/5328816 to your computer and use it in GitHub Desktop.

Select an option

Save machty/5328816 to your computer and use it in GitHub Desktop.
# Default ApplicationRoute
App.ApplicationRoute = Em.Route.extend
events:
routeTo: (routeName, objects...) ->
@router.transitionTo.apply @router, arguments
# {{linkTo}} will call routeTo
# URL changes (handleURL) will determine target route name,
# then call routeTo, so it's handleable.
# separate ember-transitions library:
# overrides App.ApplicationRoute
App.ApplicationRoute.events.routeTo = ->
Ember.Transitions.handleTransition.apply arguments
# ember-transitions will inject/handle the DSL for
# transitions that is suggested in my gist, e.g.:
App.AdminRoute = Em.Route.extend
transitions:
'from *': (e) ->
e.preventTransition() if notLoggedIn()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment