Commit 58488eaa by Matt Drayer

Merge pull request #9782 from edx/asadiqbal08/SOL-1188

SOL-1188 Cancel button Saving not Canceling
parents 95da57cc 5ae0562e
...@@ -63,6 +63,11 @@ function(_, str, Backbone, BackboneRelational, gettext) { ...@@ -63,6 +63,11 @@ function(_, str, Backbone, BackboneRelational, gettext) {
setOriginalAttributes: function() { setOriginalAttributes: function() {
// Remember the current state of this model (enables edit->cancel use cases) // Remember the current state of this model (enables edit->cancel use cases)
this._originalAttributes = this.parse(this.toJSON()); this._originalAttributes = this.parse(this.toJSON());
},
reset: function() {
// Revert the attributes of this model instance back to initial state
this.set(this._originalAttributes, { parse: true, validate: true });
} }
}); });
return Signatory; return Signatory;
......
...@@ -73,6 +73,7 @@ function ($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Sign ...@@ -73,6 +73,7 @@ function ($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Sign
actionableModel.save({}, { actionableModel.save({}, {
success: function() { success: function() {
actionableModel.setOriginalAttributes(); actionableModel.setOriginalAttributes();
self.model.setOriginalAttributes();
dfd.resolve(); dfd.resolve();
self.closeSignatoryEditView(); self.closeSignatoryEditView();
}.bind(this) }.bind(this)
...@@ -84,6 +85,7 @@ function ($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Sign ...@@ -84,6 +85,7 @@ function ($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Sign
closeSignatoryEditView: function(event) { closeSignatoryEditView: function(event) {
// Enable the cancellation workflow for the editing view // Enable the cancellation workflow for the editing view
if (event && event.preventDefault) { event.preventDefault(); } if (event && event.preventDefault) { event.preventDefault(); }
if (event) { this.model.reset(); }
this.render(); this.render();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment