1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-20 21:55:03 -04:00

Fixed: Cancelling editing a modal will reset to previous saved state

This commit is contained in:
Mark McDowall
2014-08-14 23:06:17 -07:00
parent 39c66b7951
commit d76e3d2ed6
16 changed files with 216 additions and 285 deletions
+6 -25
View File
@@ -5,40 +5,21 @@ define(
'vent',
'marionette',
'Mixins/AsModelBoundView',
'Mixins/AsValidatedView'
], function (vent, Marionette, AsModelBoundView, AsValidatedView) {
'Mixins/AsValidatedView',
'Mixins/AsEditModalView'
], function (vent, Marionette, AsModelBoundView, AsValidatedView, AsEditModalView) {
var view = Marionette.ItemView.extend({
template: 'Settings/Metadata/MetadataEditViewTemplate',
ui: {
activity: '.x-activity'
},
events: {
'click .x-save' : '_save'
},
_save: function () {
this.ui.activity.html('<i class="icon-nd-spinner"></i>');
var self = this;
var promise = this.model.save();
if (promise) {
promise.done(function () {
vent.trigger(vent.Commands.CloseModalCommand);
});
promise.fail(function () {
self.ui.activity.empty();
});
}
_onAfterSave: function () {
vent.trigger(vent.Commands.CloseModalCommand);
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
AsEditModalView.call(view);
return view;
});