2013-05-23 07:12:01 +02:00
|
|
|
|
'use strict';
|
|
|
|
|
define(['app', 'Settings/SettingsModel', 'Shared/Messenger'], function () {
|
|
|
|
|
|
|
|
|
|
NzbDrone.Settings.General.GeneralView = Backbone.Marionette.ItemView.extend({
|
|
|
|
|
template: 'Settings/General/GeneralTemplate',
|
|
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
|
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
saveSettings: function () {
|
|
|
|
|
if (!this.model.isSaved) {
|
2013-05-29 02:44:29 +02:00
|
|
|
|
this.model.save(undefined, this.syncNotification("General Settings Saved", "Couldn't Save General Settings"));
|
2013-05-23 07:12:01 +02:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
syncNotification: function (success, error) {
|
|
|
|
|
return {
|
|
|
|
|
success: function () {
|
2013-05-29 02:44:29 +02:00
|
|
|
|
NzbDrone.Shared.Messenger.show({message: success});
|
2013-05-23 07:12:01 +02:00
|
|
|
|
},
|
|
|
|
|
error : function () {
|
2013-05-29 02:44:29 +02:00
|
|
|
|
NzbDrone.Shared.Messenger.show({message: error, type: 'error'});
|
2013-05-23 07:12:01 +02:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|