mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
New: Toggle selected on Wanted: Missing to change monitored status
This commit is contained in:
parent
2c52ac1a7b
commit
9cf575c096
@ -33,6 +33,10 @@ module.exports = Marionette.ItemView.extend({
|
||||
this.$el.addClass(this.model.get('className'));
|
||||
}
|
||||
|
||||
if (this.model.get('tooltip')) {
|
||||
this.$el.attr('title', this.model.get('tooltip'));
|
||||
}
|
||||
|
||||
var command = this.model.get('command');
|
||||
if (command) {
|
||||
var properties = _.extend({ name : command }, this.model.get('properties'));
|
||||
|
@ -1,3 +1,4 @@
|
||||
var $ = require('jquery');
|
||||
var _ = require('underscore');
|
||||
var Marionette = require('marionette');
|
||||
var Backgrid = require('backgrid');
|
||||
@ -113,6 +114,14 @@ module.exports = Marionette.Layout.extend({
|
||||
ownerContext : this,
|
||||
className : 'x-search-missing'
|
||||
},
|
||||
{
|
||||
title : 'Toggle Selected',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
tooltip : 'Toggle monitored status of selected',
|
||||
callback : this._toggleMonitoredOfSelected,
|
||||
ownerContext : this,
|
||||
className : 'x-unmonitor-selected'
|
||||
},
|
||||
{
|
||||
title : 'Season Pass',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
@ -191,5 +200,28 @@ module.exports = Marionette.Layout.extend({
|
||||
'One API request to each indexer will be used for each episode. ' + 'This cannot be stopped once started.')) {
|
||||
CommandController.Execute('missingEpisodeSearch', { name : 'missingEpisodeSearch' });
|
||||
}
|
||||
},
|
||||
_toggleMonitoredOfSelected : function() {
|
||||
var selected = this.missingGrid.getSelectedModels();
|
||||
|
||||
if (selected.length === 0) {
|
||||
Messenger.show({
|
||||
type : 'error',
|
||||
message : 'No episodes selected'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var promises = [];
|
||||
var self = this;
|
||||
|
||||
_.each(selected, function (episode) {
|
||||
episode.set('monitored', !episode.get('monitored'));
|
||||
promises.push(episode.save());
|
||||
});
|
||||
|
||||
$.when(promises).done(function () {
|
||||
self.collection.fetch();
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user