Calendar is coming together!

This commit is contained in:
Mark McDowall
2013-02-28 08:34:18 -08:00
parent 4e1c04b186
commit 14cf5bf3cc
7 changed files with 53 additions and 13 deletions

View File

@@ -2,10 +2,41 @@
NzbDrone.Calendar.CalendarModel = Backbone.Model.extend({
mutators: {
title: function () {
return this.get('seriesTitle') + ' - ' + this.get('seasonNumber') + 'x' + this.get('episodeNumber').pad(2);
return this.get('seriesTitle');
},
allDay: function(){
return false;
},
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';
}
},
defaults: {