2013-05-28 03:19:07 +03: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 03:44:29 +03:00
|
|
|
initialize: function (options) {
|
|
|
|
this.indexerCollection = options.indexerCollection;
|
2013-05-28 03:19:07 +03:00
|
|
|
},
|
|
|
|
|
2013-05-29 03:44:29 +03:00
|
|
|
save: function () {
|
|
|
|
this.model.save(undefined, this.syncNotification("Indexer Saved", "Couldn't Save Indexer", this));
|
|
|
|
},
|
2013-05-28 03:19:07 +03:00
|
|
|
|
2013-05-29 03:44:29 +03:00
|
|
|
syncNotification: function (success, error, context) {
|
2013-05-28 03:19:07 +03:00
|
|
|
return {
|
|
|
|
success: function () {
|
2013-05-29 03:44:29 +03:00
|
|
|
NzbDrone.Shared.Messenger.show({
|
|
|
|
message: success
|
|
|
|
});
|
|
|
|
|
|
|
|
context.indexerCollection.add(context.model);
|
2013-05-29 09:24:45 +03:00
|
|
|
NzbDrone.modalRegion.closeModal();
|
2013-05-28 03:19:07 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
error: function () {
|
|
|
|
window.alert(error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|