
* don't use __container__ * register it as a factory on container and inject into routes and controller * avoid afterSignIn errors by checking on hooksTarget, ApplicationRoute should register itself as a hooksTarget * keep user info on auth
20 lines
572 B
CoffeeScript
20 lines
572 B
CoffeeScript
delegate = (name, options) ->
|
|
options ||= options
|
|
->
|
|
target = @get(options.to)
|
|
target[name].apply(target, arguments)
|
|
|
|
Travis.CurrentUserController = Em.ObjectController.extend
|
|
sync: ->
|
|
@get('content').sync()
|
|
|
|
content: (->
|
|
@get('auth.currentUser')
|
|
).property('auth.currentUser')
|
|
|
|
syncingDidChange: (->
|
|
if (user = @get('content')) && user.get('isSyncing') && !user.get('syncedAt')
|
|
Ember.run.scheduleOnce 'routerTransitions', this, ->
|
|
@container.lookup('router:main').send('renderFirstSync')
|
|
).observes('isSyncing', 'content')
|