mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
Calendar is coming together!
This commit is contained in:
parent
4e1c04b186
commit
14cf5bf3cc
7 changed files with 53 additions and 13 deletions
|
@ -71,7 +71,7 @@
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.existing-root-folder-view, h1 {
|
.existing-root-folder-view h1 {
|
||||||
padding: 10px 0 20px 0;
|
padding: 10px 0 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
define(['app', 'Calendar/CalendarModel'], function () {
|
define(['app', 'Calendar/CalendarModel'], function () {
|
||||||
NzbDrone.Calendar.CalendarCollection = Backbone.Collection.extend({
|
NzbDrone.Calendar.CalendarCollection = Backbone.Collection.extend({
|
||||||
url: NzbDrone.Constants.ApiRoot + '/calendar',
|
url: NzbDrone.Constants.ApiRoot + '/calendar',
|
||||||
model: NzbDrone.Calendar.CalendarModel
|
model: NzbDrone.Calendar.CalendarModel,
|
||||||
|
comparator: function(model) {
|
||||||
|
return model.get('start');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,3 +1,6 @@
|
||||||
<div id="calendar">
|
<div id="events" class="span3">
|
||||||
|
<h4>Upcoming</h4>
|
||||||
</div>
|
</div>
|
||||||
<div id="upcomingContainer"></div>
|
<div class=span9>
|
||||||
|
<div id="calendar"></div>
|
||||||
|
</div>
|
|
@ -3,8 +3,9 @@
|
||||||
define(['app', 'Calendar/CalendarItemView'], function (app) {
|
define(['app', 'Calendar/CalendarItemView'], function (app) {
|
||||||
NzbDrone.Calendar.CalendarCollectionView = Backbone.Marionette.CompositeView.extend({
|
NzbDrone.Calendar.CalendarCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||||
itemView: NzbDrone.Calendar.CalendarItemView,
|
itemView: NzbDrone.Calendar.CalendarItemView,
|
||||||
itemViewContainer: '#upcomingContainer',
|
itemViewContainer: '#events',
|
||||||
template: 'Calendar/CalendarCollectionTemplate',
|
template: 'Calendar/CalendarCollectionTemplate',
|
||||||
|
className: 'row',
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
calendar: '#calendar'
|
calendar: '#calendar'
|
||||||
|
@ -17,7 +18,7 @@ define(['app', 'Calendar/CalendarItemView'], function (app) {
|
||||||
onCompositeCollectionRendered: function() {
|
onCompositeCollectionRendered: function() {
|
||||||
$(this.ui.calendar).fullCalendar({
|
$(this.ui.calendar).fullCalendar({
|
||||||
allDayDefault: false,
|
allDayDefault: false,
|
||||||
//ignoreTimezone: false,
|
ignoreTimezone: false,
|
||||||
weekMode: 'variable',
|
weekMode: 'variable',
|
||||||
header: {
|
header: {
|
||||||
left: 'prev,next today',
|
left: 'prev,next today',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<td>{{seriesTitle}}</td>
|
<div class="date {{statusLevel}}">
|
||||||
<td>{{seasonNumber}}x{{episodeNumber}}</td>
|
<h1>{{day}}</h1>
|
||||||
<td>{{episodeTitle}}</td>
|
<h4>{{month}}</h4>
|
||||||
<td>{{airTime}}</td>
|
</div>
|
||||||
<td>{{status}}</td>
|
<h4>{{seriesTitle}}</h4>
|
||||||
|
<p>{{startTime}}<span class="pull-right">{{seasonNumber}}x{{paddedEpisodeNumber}}</span><br>{{episodeTitle}}</p>
|
||||||
|
|
|
@ -7,7 +7,8 @@ define([
|
||||||
], function () {
|
], function () {
|
||||||
NzbDrone.Calendar.CalendarItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.Calendar.CalendarItemView = Backbone.Marionette.ItemView.extend({
|
||||||
template: 'Calendar/CalendarItemTemplate',
|
template: 'Calendar/CalendarItemTemplate',
|
||||||
tagName: 'tr',
|
tagName: 'div',
|
||||||
|
className: 'event',
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||||
|
|
|
@ -2,10 +2,41 @@
|
||||||
NzbDrone.Calendar.CalendarModel = Backbone.Model.extend({
|
NzbDrone.Calendar.CalendarModel = Backbone.Model.extend({
|
||||||
mutators: {
|
mutators: {
|
||||||
title: function () {
|
title: function () {
|
||||||
return this.get('seriesTitle') + ' - ' + this.get('seasonNumber') + 'x' + this.get('episodeNumber').pad(2);
|
return this.get('seriesTitle');
|
||||||
},
|
},
|
||||||
allDay: function(){
|
allDay: function(){
|
||||||
return false;
|
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: {
|
defaults: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue