mirror of
https://github.com/Lidarr/Lidarr
synced 2026-01-19 05:52:57 +01:00
* First Pass At AlbumPass Page, Also Fixes Monitoring First Pass At AlbumPass Page, Also Fixes Monitoring * Catchy New Name, Fix Crash when visit Wanted Page Catchy New Name, Fix Crash when visit Wanted Page * Rename API to match Rename API to match * Get Bulk Monitoring Working on Album Studio Page Get Bulk Monitoring Working on Album Studio Page * Fix Wanted Query Fix Wanted Query * Codacy Codacy * Fix Cutoff Link To AlbumStudio Fix Cutoff Link To AlbumStudio * Add Header, Move Artist Monitor, Change Artist Column Heading Add Header, Move Artist Monitor, Change Artist Column Heading
64 lines
No EOL
1.8 KiB
JavaScript
64 lines
No EOL
1.8 KiB
JavaScript
var vent = require('vent');
|
|
var Marionette = require('marionette');
|
|
var Backgrid = require('backgrid');
|
|
var ToggleCell = require('../Cells/TrackMonitoredCell');
|
|
var CommandController = require('../Commands/CommandController');
|
|
var moment = require('moment');
|
|
var _ = require('underscore');
|
|
var Messenger = require('../Shared/Messenger');
|
|
|
|
module.exports = Marionette.Layout.extend({
|
|
template : 'AlbumStudio/SingleAlbumCellTemplate',
|
|
|
|
ui : {
|
|
albumMonitored : '.x-album-monitored'
|
|
},
|
|
|
|
events : {
|
|
'click .x-album-monitored' : '_albumMonitored'
|
|
},
|
|
|
|
|
|
initialize : function(options) {
|
|
this.artist = options.artist;
|
|
this.listenTo(this.model, 'sync', this._afterAlbumMonitored);
|
|
|
|
},
|
|
|
|
onRender : function() {
|
|
this._setAlbumMonitoredState();
|
|
},
|
|
|
|
_albumMonitored : function() {
|
|
if (!this.artist.get('monitored')) {
|
|
|
|
Messenger.show({
|
|
message : 'Unable to change monitored state when artist is not monitored',
|
|
type : 'error'
|
|
});
|
|
|
|
return;
|
|
}
|
|
|
|
var savePromise = this.model.save('monitored', !this.model.get('monitored'), { wait : true });
|
|
|
|
this.ui.albumMonitored.spinForPromise(savePromise);
|
|
},
|
|
|
|
_afterAlbumMonitored : function() {
|
|
this.render();
|
|
},
|
|
|
|
_setAlbumMonitoredState : function() {
|
|
this.ui.albumMonitored.removeClass('icon-lidarr-spinner fa-spin');
|
|
|
|
if (this.model.get('monitored')) {
|
|
this.ui.albumMonitored.addClass('icon-lidarr-monitored');
|
|
this.ui.albumMonitored.removeClass('icon-lidarr-unmonitored');
|
|
} else {
|
|
this.ui.albumMonitored.addClass('icon-lidarr-unmonitored');
|
|
this.ui.albumMonitored.removeClass('icon-lidarr-monitored');
|
|
}
|
|
}
|
|
|
|
}); |