try some things

This commit is contained in:
Lisa P 2015-10-14 12:56:44 +02:00
parent 10a747d2ac
commit fa0d533059
3 changed files with 37 additions and 20 deletions

View File

@ -51,7 +51,6 @@ Controller = Ember.Controller.extend
Visibility.every @config.intervals.updateTimes, @updateTimes.bind(this)
runningJobs: (->
# TODO: this should also query for received jobs
result = @store.filter('job', {}, (job) ->
['queued', 'started', 'received'].indexOf(job.get('state')) != -1
)

View File

@ -6,6 +6,9 @@ Controller = Ember.Controller.extend
needs: ['currentUser']
userBinding: 'controllers.currentUser.model'
store: Ember.inject.service()
currentUserBinding: 'auth.currentUser'
userName: (->
@get('user.name') || @get('user.login')
).property('user.login', 'user.name')
@ -14,6 +17,21 @@ Controller = Ember.Controller.extend
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=48&d=mm"
).property('user.gravatarId')
unseenBroadcasts: (->
@get('broadcasts').filter (broadcast) ->
!broadcast.get('isSeen')
).property('broadcasts.[]', 'broadcasts.length')
v2broadcasts: (->
broadcasts = Ember.ArrayProxy.create(content: [])
if @get('currentUser.id')
@get('store').find('broadcast').then (result) ->
broadcasts.pushObjects(result.toArray())
broadcasts
).property('currentUser.id')
broadcasts: (->
if @get('auth.signedIn')

View File

@ -11,28 +11,28 @@ FlashesService = Ember.Service.extend
@set('flashes', LimitedArray.create(limit: 1, content: []))
messages: (->
broadcasts = @get('unseenBroadcasts')
#broadcasts = @get('unseenBroadcasts')
flashes = @get('flashes')
model = []
model.pushObjects(broadcasts) if broadcasts
# model.pushObjects(broadcasts) if broadcasts
model.pushObjects(flashes.toArray().reverse()) if flashes
model.uniq()
).property('unseenBroadcasts.[]', 'flashes.[]', 'unseenBroadcasts.length', 'flashes.length')
).property('flashes.[]', 'flashes.length')
unseenBroadcasts: (->
@get('broadcasts').filter (broadcast) ->
!broadcast.get('isSeen')
).property('broadcasts.[]', 'broadcasts.length')
# unseenBroadcasts: (->
# @get('broadcasts').filter (broadcast) ->
# !broadcast.get('isSeen')
# ).property('broadcasts.[]', 'broadcasts.length')
broadcasts: (->
broadcasts = Ember.ArrayProxy.create(content: [])
# broadcasts: (->
# broadcasts = Ember.ArrayProxy.create(content: [])
if @get('currentUser.id')
@get('store').find('broadcast').then (result) ->
broadcasts.pushObjects(result.toArray())
# if @get('currentUser.id')
# @get('store').find('broadcast').then (result) ->
# broadcasts.pushObjects(result.toArray())
broadcasts
).property('currentUser.id')
# broadcasts
# ).property('currentUser.id')
loadFlashes: (msgs) ->
for msg in msgs
@ -42,10 +42,10 @@ FlashesService = Ember.Service.extend
Ember.run.later(this, (-> @get('flashes.content').removeObject(msg)), 15000)
close: (msg) ->
if msg.constructor.modelName == "broadcast"
msg.setSeen()
@notifyPropertyChange('unseenBroadcasts')
else
@get('flashes').removeObject(msg)
# if msg.constructor.modelName == "broadcast"
# msg.setSeen()
# @notifyPropertyChange('unseenBroadcasts')
# else
@get('flashes').removeObject(msg)
`export default FlashesService`