2013-02-23 20:42:15 +03:00
|
|
|
define(['app'], function (app) {
|
|
|
|
NzbDrone.Calendar.CalendarModel = Backbone.Model.extend({
|
|
|
|
mutators: {
|
2013-02-25 03:00:17 +03:00
|
|
|
title: function () {
|
2013-02-28 19:34:18 +03:00
|
|
|
return this.get('seriesTitle');
|
2013-02-25 03:00:17 +03:00
|
|
|
},
|
|
|
|
allDay: function(){
|
|
|
|
return false;
|
2013-02-28 19:34:18 +03:00
|
|
|
},
|
|
|
|
day: function() {
|
|
|
|
return Date.create(this.get('start')).format('{dd}');
|
|
|
|
},
|
|
|
|
month: function(){
|
|
|
|
return Date.create(this.get('start')).format('{MON}');
|
|
|
|
},
|
|
|
|
startTime: function(){
|
|
|
|
var start = Date.create(this.get('start'));
|
|
|
|
|
|
|
|
if (start.format('{mm}') === '00')
|
|
|
|
return start.format('{h}{tt}');
|
|
|
|
|
|
|
|
return start.format('{h}.{mm}{tt}');
|
|
|
|
},
|
|
|
|
paddedEpisodeNumber: function(){
|
|
|
|
return this.get('episodeNumber');
|
|
|
|
},
|
|
|
|
statusLevel: function() {
|
|
|
|
var status = this.get('status');
|
|
|
|
var currentTime = Date.create();
|
|
|
|
var start = Date.create(this.get('start'));
|
|
|
|
var end = Date.create(this.get('end'));
|
|
|
|
|
|
|
|
if (currentTime.isBetween(start, end))
|
|
|
|
return 'warning';
|
|
|
|
|
|
|
|
if (status === 'Missing') return 'danger';
|
|
|
|
if (status === 'Ready') return 'success';
|
|
|
|
|
|
|
|
return 'info';
|
2013-02-25 03:00:17 +03:00
|
|
|
}
|
2013-02-23 20:42:15 +03:00
|
|
|
},
|
|
|
|
defaults: {
|
|
|
|
status: 0
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|