|
|
@ -2,10 +2,11 @@ var $ = require('jquery');
|
|
|
|
var vent = require('vent');
|
|
|
|
var vent = require('vent');
|
|
|
|
var Marionette = require('marionette');
|
|
|
|
var Marionette = require('marionette');
|
|
|
|
var moment = require('moment');
|
|
|
|
var moment = require('moment');
|
|
|
|
var CalendarCollection = require('./Collection');
|
|
|
|
var CalendarCollection = require('./CalendarCollection');
|
|
|
|
var UiSettings = require('../Shared/UiSettingsModel');
|
|
|
|
var UiSettings = require('../Shared/UiSettingsModel');
|
|
|
|
var QueueCollection = require('../Activity/Queue/QueueCollection');
|
|
|
|
var QueueCollection = require('../Activity/Queue/QueueCollection');
|
|
|
|
var Config = require('../Config');
|
|
|
|
var Config = require('../Config');
|
|
|
|
|
|
|
|
|
|
|
|
require('../Mixins/backbone.signalr.mixin');
|
|
|
|
require('../Mixins/backbone.signalr.mixin');
|
|
|
|
require('fullcalendar');
|
|
|
|
require('fullcalendar');
|
|
|
|
require('jquery.easypiechart');
|
|
|
|
require('jquery.easypiechart');
|
|
|
@ -14,6 +15,7 @@ module.exports = Marionette.ItemView.extend({
|
|
|
|
storageKey : 'calendar.view',
|
|
|
|
storageKey : 'calendar.view',
|
|
|
|
|
|
|
|
|
|
|
|
initialize : function() {
|
|
|
|
initialize : function() {
|
|
|
|
|
|
|
|
this.showUnmonitored = Config.getValue('calendar.show', 'monitored') === 'all';
|
|
|
|
this.collection = new CalendarCollection().bindSignalR({ updateOnly : true });
|
|
|
|
this.collection = new CalendarCollection().bindSignalR({ updateOnly : true });
|
|
|
|
this.listenTo(this.collection, 'change', this._reloadCalendarEvents);
|
|
|
|
this.listenTo(this.collection, 'change', this._reloadCalendarEvents);
|
|
|
|
this.listenTo(QueueCollection, 'sync', this._reloadCalendarEvents);
|
|
|
|
this.listenTo(QueueCollection, 'sync', this._reloadCalendarEvents);
|
|
|
@ -27,6 +29,13 @@ module.exports = Marionette.ItemView.extend({
|
|
|
|
this.$('.fc-button-today').click();
|
|
|
|
this.$('.fc-button-today').click();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setShowUnmonitored : function (showUnmonitored) {
|
|
|
|
|
|
|
|
if (this.showUnmonitored !== showUnmonitored) {
|
|
|
|
|
|
|
|
this.showUnmonitored = showUnmonitored;
|
|
|
|
|
|
|
|
this._getEvents(this.$el.fullCalendar('getView'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_viewRender : function(view) {
|
|
|
|
_viewRender : function(view) {
|
|
|
|
if ($(window).width() < 768) {
|
|
|
|
if ($(window).width() < 768) {
|
|
|
|
this.$('.fc-header-title').show();
|
|
|
|
this.$('.fc-header-title').show();
|
|
|
@ -105,8 +114,9 @@ module.exports = Marionette.ItemView.extend({
|
|
|
|
|
|
|
|
|
|
|
|
this.collection.fetch({
|
|
|
|
this.collection.fetch({
|
|
|
|
data : {
|
|
|
|
data : {
|
|
|
|
start : start,
|
|
|
|
start : start,
|
|
|
|
end : end
|
|
|
|
end : end,
|
|
|
|
|
|
|
|
unmonitored : this.showUnmonitored
|
|
|
|
},
|
|
|
|
},
|
|
|
|
success : this._setEventData.bind(this)
|
|
|
|
success : this._setEventData.bind(this)
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -145,6 +155,7 @@ module.exports = Marionette.ItemView.extend({
|
|
|
|
var currentTime = moment();
|
|
|
|
var currentTime = moment();
|
|
|
|
var start = moment(element.get('airDateUtc'));
|
|
|
|
var start = moment(element.get('airDateUtc'));
|
|
|
|
var end = moment(endTime);
|
|
|
|
var end = moment(endTime);
|
|
|
|
|
|
|
|
var monitored = element.get('series').monitored && element.get('monitored');
|
|
|
|
|
|
|
|
|
|
|
|
var statusLevel = 'primary';
|
|
|
|
var statusLevel = 'primary';
|
|
|
|
|
|
|
|
|
|
|
@ -156,6 +167,10 @@ module.exports = Marionette.ItemView.extend({
|
|
|
|
statusLevel = 'purple';
|
|
|
|
statusLevel = 'purple';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (!monitored) {
|
|
|
|
|
|
|
|
statusLevel = 'unmonitored';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
|
|
|
else if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
|
|
|
statusLevel = 'warning';
|
|
|
|
statusLevel = 'warning';
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -231,6 +246,7 @@ module.exports = Marionette.ItemView.extend({
|
|
|
|
|
|
|
|
|
|
|
|
return options;
|
|
|
|
return options;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_addStatusIcon : function(element, icon, tooltip) {
|
|
|
|
_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('.fc-event-time').after('<span class="status pull-right"><i class="{0}"></i></span>'.format(icon));
|
|
|
|
this.$(element).find('.status').tooltip({
|
|
|
|
this.$(element).find('.status').tooltip({
|
|
|
|