1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-25 11:13:39 +02:00
Sonarr/src/UI/Settings/SettingsModelBase.js

37 lines
965 B
JavaScript
Raw Normal View History

2013-06-21 23:24:24 -07:00
'use strict';
2013-10-08 18:43:41 -07:00
define(
[
'vent',
'backbone.deepmodel',
'Mixins/AsChangeTrackingModel',
'Shared/Messenger'
], function (vent, DeepModel, AsChangeTrackingModel, Messenger) {
var model = DeepModel.DeepModel.extend({
2013-10-08 18:43:41 -07:00
initialize: function () {
this.listenTo(vent, vent.Commands.SaveSettings, this.saveSettings);
},
2013-10-08 18:43:41 -07:00
saveSettings: function () {
2013-10-08 18:43:41 -07:00
if (!this.isSaved) {
2013-10-08 18:43:41 -07:00
var savePromise = this.save();
2013-10-08 18:43:41 -07:00
Messenger.monitor({
promise : savePromise,
successMessage: this.successMessage,
errorMessage : this.errorMessage
});
2013-10-08 18:43:41 -07:00
return savePromise;
}
return undefined;
}
2013-10-08 18:43:41 -07:00
});
2013-10-08 18:43:41 -07:00
return AsChangeTrackingModel.call(model);
});