Fix broadcasts
This commit is contained in:
parent
3feaf18e1e
commit
c6ee26c2e5
|
@ -14,17 +14,24 @@ Controller = Ember.ArrayController.extend
|
||||||
broadcasts = @get('unseenBroadcasts')
|
broadcasts = @get('unseenBroadcasts')
|
||||||
flashes = @get('flashes')
|
flashes = @get('flashes')
|
||||||
model = []
|
model = []
|
||||||
model = model.concat(broadcasts.toArray()) if broadcasts
|
model.pushObjects(broadcasts) if broadcasts
|
||||||
model = model.concat(flashes.toArray().reverse()) if flashes
|
model.pushObjects(flashes.toArray().reverse()) if flashes
|
||||||
model.uniq()
|
model.uniq()
|
||||||
).property('unseenBroadcasts.length', 'flashes.length')
|
).property('unseenBroadcasts.[]', 'flashes.[]')
|
||||||
|
|
||||||
unseenBroadcasts: (->
|
unseenBroadcasts: (->
|
||||||
@get('broadcasts').filterProperty('isSeen', false)
|
@get('broadcasts').filter (broadcast) ->
|
||||||
).property('broadcasts.isLoaded', 'broadcasts.length')
|
!broadcast.get('isSeen')
|
||||||
|
).property('broadcasts.[]')
|
||||||
|
|
||||||
broadcasts: (->
|
broadcasts: (->
|
||||||
if @get('currentUser.id') then @store.find('broadcast') else Ember.A()
|
broadcasts = Ember.ArrayProxy.create(content: [])
|
||||||
|
|
||||||
|
if @get('currentUser.id')
|
||||||
|
@store.find('broadcast').then (result) ->
|
||||||
|
broadcasts.pushObjects(result.toArray())
|
||||||
|
|
||||||
|
broadcasts
|
||||||
).property('currentUser.id')
|
).property('currentUser.id')
|
||||||
|
|
||||||
loadFlashes: (msgs) ->
|
loadFlashes: (msgs) ->
|
||||||
|
|
|
@ -8,12 +8,12 @@ Broadcast = Model.extend
|
||||||
{ type: 'broadcast', id: @get('id'), message: @get('message') }
|
{ type: 'broadcast', id: @get('id'), message: @get('message') }
|
||||||
|
|
||||||
isSeen: (->
|
isSeen: (->
|
||||||
@get('id') in Broadcast.get('seen')
|
@get('id') in Ember.get(Broadcast, 'seen')
|
||||||
).property()
|
).property()
|
||||||
|
|
||||||
setSeen: ->
|
setSeen: ->
|
||||||
Broadcast.get('seen').pushObject(@get('id'))
|
Ember.get(Broadcast, 'seen').pushObject(@get('id'))
|
||||||
Travis.storage.setItem('travis.seen_broadcasts', JSON.stringify(Broadcast.get('seen')))
|
Travis.storage.setItem('travis.seen_broadcasts', JSON.stringify(Ember.get(Broadcast, 'seen')))
|
||||||
@notifyPropertyChange('isSeen')
|
@notifyPropertyChange('isSeen')
|
||||||
|
|
||||||
Broadcast.reopenClass
|
Broadcast.reopenClass
|
||||||
|
|
|
@ -3,11 +3,15 @@
|
||||||
font-size: 18px
|
font-size: 18px
|
||||||
text-align: center
|
text-align: center
|
||||||
li
|
li
|
||||||
opacity: 0
|
top: 0
|
||||||
position: relative
|
position: relative
|
||||||
|
li.notice, li.success, li.error
|
||||||
|
opacity: 0
|
||||||
max-height: 3.5rem
|
max-height: 3.5rem
|
||||||
height: 0
|
height: 0
|
||||||
animation: comeIn 7s 1 ease
|
animation: comeIn 7s 1 ease
|
||||||
|
li.broadcast
|
||||||
|
height: auto
|
||||||
|
|
||||||
.close
|
.close
|
||||||
@extend .icon
|
@extend .icon
|
||||||
|
@ -22,7 +26,8 @@
|
||||||
margin: 0
|
margin: 0
|
||||||
|
|
||||||
.success,
|
.success,
|
||||||
.notice
|
.notice,
|
||||||
|
.broadcast
|
||||||
color: #3ba85b
|
color: #3ba85b
|
||||||
background-color: #deebdd
|
background-color: #deebdd
|
||||||
.close
|
.close
|
||||||
|
|
Loading…
Reference in New Issue
Block a user