Use storage service instead of Travis.storage
This commit is contained in:
parent
1843d8cb54
commit
ab0b0cbebc
|
@ -6,6 +6,7 @@ Controller = Ember.Controller.extend
|
|||
userBinding: 'auth.currentUser'
|
||||
|
||||
store: Ember.inject.service()
|
||||
storage: Ember.inject.service()
|
||||
currentUserBinding: 'auth.currentUser'
|
||||
|
||||
userName: (->
|
||||
|
@ -38,7 +39,7 @@ Controller = Ember.Controller.extend
|
|||
options.type = 'GET'
|
||||
options.headers = { Authorization: "token #{@auth.token()}" }
|
||||
|
||||
seenBroadcasts = Travis.storage.getItem('travis.seen_broadcasts')
|
||||
seenBroadcasts = @get('storage').getItem('travis.seen_broadcasts')
|
||||
if seenBroadcasts
|
||||
seenBroadcasts = JSON.parse(seenBroadcasts)
|
||||
else
|
||||
|
@ -72,13 +73,13 @@ Controller = Ember.Controller.extend
|
|||
|
||||
markBroadcastAsSeen: (broadcast) ->
|
||||
id = broadcast.get('id').toString()
|
||||
seenBroadcasts = Travis.storage.getItem('travis.seen_broadcasts')
|
||||
seenBroadcasts = @get('storage').getItem('travis.seen_broadcasts')
|
||||
if seenBroadcasts
|
||||
seenBroadcasts = JSON.parse(seenBroadcasts)
|
||||
else
|
||||
seenBroadcasts = []
|
||||
seenBroadcasts.push(id)
|
||||
Travis.storage.setItem('travis.seen_broadcasts', JSON.stringify(seenBroadcasts))
|
||||
@get('storage').setItem('travis.seen_broadcasts', JSON.stringify(seenBroadcasts))
|
||||
@get('broadcasts.content').removeObject(broadcast)
|
||||
@set('broadcasts.lastBroadcastStatus', @defineTowerColor(@get('broadcasts.content')))
|
||||
return false
|
||||
|
|
|
@ -18,7 +18,7 @@ Broadcast = Model.extend
|
|||
|
||||
Broadcast.reopenClass
|
||||
seen: (->
|
||||
seenBroadcasts = Travis.storage.getItem('travis.seen_broadcasts')
|
||||
seenBroadcasts = Travis.lookup('service:storage').getItem('travis.seen_broadcasts')
|
||||
seenBroadcasts = JSON.parse(seenBroadcasts) if seenBroadcasts?
|
||||
Ember.A(seenBroadcasts || [])
|
||||
).property()
|
||||
|
|
Loading…
Reference in New Issue
Block a user