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