Destroy objects also in local storage.

This commit is contained in:
Martin Edenhofer 2013-03-21 11:26:36 +01:00
parent c73c5b0ca1
commit 288c9c0f12
2 changed files with 11 additions and 1 deletions

View file

@ -1,4 +1,13 @@
class App.Model extends Spine.Model class App.Model extends Spine.Model
constructor: ->
super
# delete object from local storage on destroy
@bind( 'destroy', (e) ->
className = Object.getPrototypeOf(e).constructor.className
key = "collection::#{className}::#{e.id}"
App.Store.delete(key)
)
displayName: -> displayName: ->
return @name if @name return @name if @name
@ -69,3 +78,4 @@ class App.Model extends Spine.Model
model: @constructor, model: @constructor,
params: @, params: @,
) )

View file

@ -1,4 +1,4 @@
class App.Sla extends Spine.Model class App.Sla extends App.Model
@configure 'Sla', 'name', 'first_response_time', 'update_time', 'close_time', 'condition', 'data', 'active' @configure 'Sla', 'name', 'first_response_time', 'update_time', 'close_time', 'condition', 'data', 'active'
@extend Spine.Model.Ajax @extend Spine.Model.Ajax
@url: 'api/slas' @url: 'api/slas'