|
|
@ -7,7 +7,7 @@ define(
|
|
|
|
'moment',
|
|
|
|
'moment',
|
|
|
|
'Calendar/Collection',
|
|
|
|
'Calendar/Collection',
|
|
|
|
'fullcalendar'
|
|
|
|
'fullcalendar'
|
|
|
|
], function (vent, Marionette, Moment, CalendarCollection) {
|
|
|
|
], function (vent, Marionette, moment, CalendarCollection) {
|
|
|
|
|
|
|
|
|
|
|
|
var _instance;
|
|
|
|
var _instance;
|
|
|
|
|
|
|
|
|
|
|
@ -16,7 +16,10 @@ define(
|
|
|
|
this.collection = new CalendarCollection();
|
|
|
|
this.collection = new CalendarCollection();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
render : function () {
|
|
|
|
render : function () {
|
|
|
|
$(this.$el).empty().fullCalendar({
|
|
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$el.empty().fullCalendar({
|
|
|
|
defaultView : 'basicWeek',
|
|
|
|
defaultView : 'basicWeek',
|
|
|
|
allDayDefault : false,
|
|
|
|
allDayDefault : false,
|
|
|
|
ignoreTimezone: false,
|
|
|
|
ignoreTimezone: false,
|
|
|
@ -34,8 +37,8 @@ define(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
events : this.getEvents,
|
|
|
|
events : this.getEvents,
|
|
|
|
eventRender : function (event, element) {
|
|
|
|
eventRender : function (event, element) {
|
|
|
|
$(element).addClass(event.statusLevel);
|
|
|
|
self.$(element).addClass(event.statusLevel);
|
|
|
|
$(element).children('.fc-event-inner').addClass(event.statusLevel);
|
|
|
|
self.$(element).children('.fc-event-inner').addClass(event.statusLevel);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
eventClick : function (event) {
|
|
|
|
eventClick : function (event) {
|
|
|
|
vent.trigger(vent.Commands.ShowEpisodeDetails, {episode: event.model});
|
|
|
|
vent.trigger(vent.Commands.ShowEpisodeDetails, {episode: event.model});
|
|
|
@ -50,8 +53,8 @@ define(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getEvents: function (start, end, callback) {
|
|
|
|
getEvents: function (start, end, callback) {
|
|
|
|
var startDate = Moment(start).toISOString();
|
|
|
|
var startDate = moment(start).toISOString();
|
|
|
|
var endDate = Moment(end).toISOString();
|
|
|
|
var endDate = moment(end).toISOString();
|
|
|
|
|
|
|
|
|
|
|
|
_instance.collection.fetch({
|
|
|
|
_instance.collection.fetch({
|
|
|
|
data : { start: startDate, end: endDate },
|
|
|
|
data : { start: startDate, end: endDate },
|
|
|
@ -61,7 +64,7 @@ define(
|
|
|
|
var seriesTitle = element.get('series').title;
|
|
|
|
var seriesTitle = element.get('series').title;
|
|
|
|
var start = element.get('airDateUtc');
|
|
|
|
var start = element.get('airDateUtc');
|
|
|
|
var runtime = element.get('series').runtime;
|
|
|
|
var runtime = element.get('series').runtime;
|
|
|
|
var end = Moment(start).add('minutes', runtime).toISOString();
|
|
|
|
var end = moment(start).add('minutes', runtime).toISOString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
element.set({
|
|
|
|
element.set({
|
|
|
@ -83,9 +86,9 @@ define(
|
|
|
|
|
|
|
|
|
|
|
|
getStatusLevel: function (element) {
|
|
|
|
getStatusLevel: function (element) {
|
|
|
|
var hasFile = element.get('hasFile');
|
|
|
|
var hasFile = element.get('hasFile');
|
|
|
|
var currentTime = Moment();
|
|
|
|
var currentTime = moment();
|
|
|
|
var start = Moment(element.get('airDateUtc'));
|
|
|
|
var start = moment(element.get('airDateUtc'));
|
|
|
|
var end = Moment(element.get('end'));
|
|
|
|
var end = moment(element.get('end'));
|
|
|
|
|
|
|
|
|
|
|
|
var statusLevel = 'primary';
|
|
|
|
var statusLevel = 'primary';
|
|
|
|
|
|
|
|
|
|
|
@ -94,10 +97,6 @@ define(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
|
|
|
else if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
|
|
|
var s = start.toISOString();
|
|
|
|
|
|
|
|
var e = end.toISOString();
|
|
|
|
|
|
|
|
var c = currentTime.toISOString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
statusLevel = 'warning';
|
|
|
|
statusLevel = 'warning';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|