Reputation: 269
In the app you can update the style and reset it. The reset is just a POST HTTP Request to <url>/style/reset
. I've overwritten the destroyRecord in the model already, but my main problem is if I "delete" the record, I have to update the view and set the resetted style.
I thought the easiest way would be to transition through the route again, but transitionToRoute in the controller doesn't call the "model" in the route again.
Route:
App.SystemStyleRoute = App.ApplicationRoute.extend
model: (params) ->
@store.find "systemStyle"
In The Controller:
reset: ->
@get('model').destroyRecord()
# route back to the page to see the resetted style
@transitionToRoute "system.style"
Upvotes: 1
Views: 166
Reputation: 625
You can use this hacky approach:
@get('model').destroyRecord().then(=> @store.find('systemStyle').then( (obj) => @set 'model', obj ) )
Edit: Fix by Nicolas.
Upvotes: 2