mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: Option to show unmonitored episodes on calendar
This commit is contained in:
parent
2a4fd2bbde
commit
ab6233dd3f
15 changed files with 176 additions and 47 deletions
|
@ -2,10 +2,11 @@ var $ = require('jquery');
|
|||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var moment = require('moment');
|
||||
var CalendarCollection = require('./Collection');
|
||||
var CalendarCollection = require('./CalendarCollection');
|
||||
var UiSettings = require('../Shared/UiSettingsModel');
|
||||
var QueueCollection = require('../Activity/Queue/QueueCollection');
|
||||
var Config = require('../Config');
|
||||
|
||||
require('../Mixins/backbone.signalr.mixin');
|
||||
require('fullcalendar');
|
||||
require('jquery.easypiechart');
|
||||
|
@ -14,6 +15,7 @@ module.exports = Marionette.ItemView.extend({
|
|||
storageKey : 'calendar.view',
|
||||
|
||||
initialize : function() {
|
||||
this.showUnmonitored = Config.getValue('calendar.show', 'monitored') === 'all';
|
||||
this.collection = new CalendarCollection().bindSignalR({ updateOnly : true });
|
||||
this.listenTo(this.collection, 'change', this._reloadCalendarEvents);
|
||||
this.listenTo(QueueCollection, 'sync', this._reloadCalendarEvents);
|
||||
|
@ -27,6 +29,13 @@ module.exports = Marionette.ItemView.extend({
|
|||
this.$('.fc-button-today').click();
|
||||
},
|
||||
|
||||
setShowUnmonitored : function (showUnmonitored) {
|
||||
if (this.showUnmonitored !== showUnmonitored) {
|
||||
this.showUnmonitored = showUnmonitored;
|
||||
this._getEvents(this.$el.fullCalendar('getView'));
|
||||
}
|
||||
},
|
||||
|
||||
_viewRender : function(view) {
|
||||
if ($(window).width() < 768) {
|
||||
this.$('.fc-header-title').show();
|
||||
|
@ -105,8 +114,9 @@ module.exports = Marionette.ItemView.extend({
|
|||
|
||||
this.collection.fetch({
|
||||
data : {
|
||||
start : start,
|
||||
end : end
|
||||
start : start,
|
||||
end : end,
|
||||
unmonitored : this.showUnmonitored
|
||||
},
|
||||
success : this._setEventData.bind(this)
|
||||
});
|
||||
|
@ -145,6 +155,7 @@ module.exports = Marionette.ItemView.extend({
|
|||
var currentTime = moment();
|
||||
var start = moment(element.get('airDateUtc'));
|
||||
var end = moment(endTime);
|
||||
var monitored = element.get('series').monitored && element.get('monitored');
|
||||
|
||||
var statusLevel = 'primary';
|
||||
|
||||
|
@ -156,6 +167,10 @@ module.exports = Marionette.ItemView.extend({
|
|||
statusLevel = 'purple';
|
||||
}
|
||||
|
||||
else if (!monitored) {
|
||||
statusLevel = 'unmonitored';
|
||||
}
|
||||
|
||||
else if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
||||
statusLevel = 'warning';
|
||||
}
|
||||
|
@ -231,6 +246,7 @@ module.exports = Marionette.ItemView.extend({
|
|||
|
||||
return options;
|
||||
},
|
||||
|
||||
_addStatusIcon : function(element, icon, tooltip) {
|
||||
this.$(element).find('.fc-event-time').after('<span class="status pull-right"><i class="{0}"></i></span>'.format(icon));
|
||||
this.$(element).find('.status').tooltip({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue