Controller#content -> Controller#model.

This commit is contained in:
Robert Jackson 2014-11-05 08:18:32 -05:00
parent f9fe221e9a
commit 0972475dcb
No known key found for this signature in database
GPG Key ID: B3D10EF8171F7219
2 changed files with 9 additions and 17 deletions

View File

@ -1,19 +1,11 @@
delegate = (name, options) ->
options ||= options
->
target = @get(options.to)
target[name].apply(target, arguments)
Travis.CurrentUserController = Em.ObjectController.extend
sync: ->
@get('content').sync()
@get('model').sync()
content: (->
@get('auth.currentUser')
).property('auth.currentUser')
model: Ember.computed.alias('auth.currentUser')
syncingDidChange: (->
if (user = @get('content')) && user.get('isSyncing') && !user.get('syncedAt')
if (user = @get('model')) && user.get('isSyncing') && !user.get('syncedAt')
Ember.run.scheduleOnce 'routerTransitions', this, ->
@container.lookup('router:main').send('renderFirstSync')
).observes('isSyncing', 'content')
).observes('isSyncing', 'auth.currentUser')

View File

@ -6,13 +6,13 @@ Travis.FlashController = Ember.ArrayController.extend
@_super.apply this, arguments
@set('flashes', Travis.LimitedArray.create(limit: 2, content: []))
content: (->
model: (->
broadcasts = @get('unseenBroadcasts')
flashes = @get('flashes')
content = []
content = content.concat(broadcasts.toArray()) if broadcasts
content = content.concat(flashes.toArray().reverse()) if flashes
content.uniq()
model = []
model = model.concat(broadcasts.toArray()) if broadcasts
model = model.concat(flashes.toArray().reverse()) if flashes
model.uniq()
).property('unseenBroadcasts.length', 'flashes.length')
unseenBroadcasts: (->