Lidarr/UI/Settings/Indexers/EditView.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2013-05-28 00:19:07 +00:00
"use strict";
define([
'app',
'Settings/Indexers/Model'
], function () {
NzbDrone.Settings.Indexers.EditView = Backbone.Marionette.ItemView.extend({
template : 'Settings/Indexers/EditTemplate',
events: {
'click .x-save': 'save'
},
2013-05-29 00:44:29 +00:00
initialize: function (options) {
this.indexerCollection = options.indexerCollection;
2013-05-28 00:19:07 +00:00
},
2013-05-29 00:44:29 +00:00
save: function () {
this.model.save(undefined, this.syncNotification("Indexer Saved", "Couldn't Save Indexer", this));
},
2013-05-28 00:19:07 +00:00
2013-05-29 00:44:29 +00:00
syncNotification: function (success, error, context) {
2013-05-28 00:19:07 +00:00
return {
success: function () {
2013-05-29 00:44:29 +00:00
NzbDrone.Shared.Messenger.show({
message: success
});
context.indexerCollection.add(context.model);
2013-05-29 06:24:45 +00:00
NzbDrone.modalRegion.closeModal();
2013-05-28 00:19:07 +00:00
},
error: function () {
window.alert(error);
}
};
}
});
});