1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-29 03:05:49 +00:00
Sonarr/UI/Settings/Indexers/EditView.js

42 lines
1 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);
context.$el.parent().modal('hide');
2013-05-28 00:19:07 +00:00
},
error: function () {
window.alert(error);
}
};
}
});
});