mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
New: Added Presets to Indexers to add indexers with default properties. In an older version of NzbDrone these default indexers were added automatically and could not be removed.
This commit is contained in:
@@ -1,32 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'jquery',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Notifications/Edit/NotificationEditView'
|
||||
], function ($, AppLayout, Marionette, EditView) {
|
||||
], function (_, $, AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
template : 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
|
||||
events: {
|
||||
'click': '_add'
|
||||
'click .x-preset': '_addPreset',
|
||||
'click' : '_add'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
_addPreset: function (e) {
|
||||
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
|
||||
var presetData = _.where(this.model.get('presets'), {name: presetName})[0];
|
||||
|
||||
this.model.set(presetData);
|
||||
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
onGrab : true,
|
||||
onDownload : true,
|
||||
onUpgrade : true
|
||||
});
|
||||
|
||||
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
|
||||
AppLayout.modalRegion.show(editView);
|
||||
},
|
||||
|
||||
_add: function (e) {
|
||||
if (this.$(e.target).hasClass('icon-info-sign')) {
|
||||
if ($(e.target).closest('.btn,.btn-group').length !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
name : this.model.get('implementation'),
|
||||
onGrab : true,
|
||||
onDownload : true,
|
||||
onUpgrade : true
|
||||
|
||||
Reference in New Issue
Block a user