make broadcasts list update itself after element is removed
This commit is contained in:
parent
14faf23d0b
commit
8bf917984c
|
@ -35,17 +35,17 @@ Controller = Ember.Controller.extend
|
||||||
|
|
||||||
$.ajax("#{apiEndpoint}/v3/broadcasts", options).then (response) ->
|
$.ajax("#{apiEndpoint}/v3/broadcasts", options).then (response) ->
|
||||||
if response.broadcasts.length
|
if response.broadcasts.length
|
||||||
array = response.broadcasts.filter((broadcast) ->
|
receivedBroadcasts = response.broadcasts.filter((broadcast) ->
|
||||||
unless broadcast.expired
|
unless broadcast.expired
|
||||||
if seenBroadcasts.indexOf(broadcast.id.toString()) == -1
|
if seenBroadcasts.indexOf(broadcast.id.toString()) == -1
|
||||||
broadcast
|
broadcast
|
||||||
).map( (broadcast) ->
|
).map( (broadcast) ->
|
||||||
Ember.Object.create(broadcast)
|
Ember.Object.create(broadcast)
|
||||||
).reverse()
|
).reverse()
|
||||||
|
|
||||||
if array.length
|
if receivedBroadcasts.length
|
||||||
broadcasts.set('lastBroadcastStatus', array[0].category)
|
broadcasts.set('lastBroadcastStatus', receivedBroadcasts[0].category)
|
||||||
broadcasts.set('content', array)
|
broadcasts.set('content', receivedBroadcasts)
|
||||||
broadcasts.set('isLoading', false)
|
broadcasts.set('isLoading', false)
|
||||||
|
|
||||||
broadcasts
|
broadcasts
|
||||||
|
@ -69,6 +69,7 @@ Controller = Ember.Controller.extend
|
||||||
seenBroadcasts = []
|
seenBroadcasts = []
|
||||||
seenBroadcasts.push(id)
|
seenBroadcasts.push(id)
|
||||||
Travis.storage.setItem('travis.seen_broadcasts', JSON.stringify(seenBroadcasts))
|
Travis.storage.setItem('travis.seen_broadcasts', JSON.stringify(seenBroadcasts))
|
||||||
|
@get('broadcasts.content').removeObject(broadcast)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user