2013-05-31 04:06:52 +00:00
|
|
|
"use strict";
|
2013-06-14 23:18:37 +00:00
|
|
|
define(['app'], function () {
|
2013-05-31 04:06:52 +00:00
|
|
|
|
|
|
|
NzbDrone.Mixins.SaveIfChangedModel = {
|
2013-06-14 23:18:37 +00:00
|
|
|
// originalInitialize: this.initialize,
|
2013-05-31 04:06:52 +00:00
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
this.isSaved = true;
|
|
|
|
|
|
|
|
this.on('change', function () {
|
|
|
|
this.isSaved = false;
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
this.on('sync', function () {
|
|
|
|
this.isSaved = true;
|
|
|
|
}, this);
|
|
|
|
|
2013-06-14 23:18:37 +00:00
|
|
|
// if (originalInitialize) {
|
|
|
|
// originalInitialize.call(this);
|
|
|
|
// }
|
2013-05-31 04:06:52 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
saveIfChanged: function (options) {
|
|
|
|
if (!this.isSaved) {
|
|
|
|
this.save(undefined, options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2013-06-14 23:18:37 +00:00
|
|
|
|
|
|
|
return NzbDrone.Missing.SaveIfChangedModel;
|
|
|
|
});
|