1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-10 04:52:42 +01:00
Radarr/NzbDrone.Backbone/Calendar/CalendarCollectionView.js

50 lines
1.8 KiB
JavaScript
Raw Normal View History

'use strict';
define(['app', 'Calendar/CalendarItemView'], function (app) {
NzbDrone.Calendar.CalendarCollectionView = Backbone.Marionette.CompositeView.extend({
itemView: NzbDrone.Calendar.CalendarItemView,
2013-02-26 04:30:24 +01:00
itemViewContainer: '#upcomingContainer',
template: 'Calendar/CalendarCollectionTemplate',
ui: {
calendar: '#calendar'
},
2013-02-25 01:00:17 +01:00
initialize: function (context, collection) {
this.collection = collection;
2013-02-26 04:30:24 +01:00
this.calendar = new NzbDrone.Calendar.CalendarCollection();
},
2013-02-26 04:30:24 +01:00
onCompositeCollectionRendered: function() {
2013-02-25 01:00:17 +01:00
$(this.ui.calendar).fullCalendar({
2013-02-26 04:30:24 +01:00
allDayDefault: false,
//ignoreTimezone: false,
weekMode: 'variable',
header: {
left: 'prev,next today',
center: 'title',
2013-02-26 04:30:24 +01:00
right: 'month,basicWeek'
},
2013-02-25 01:00:17 +01:00
buttonText: {
prev: '<i class="icon-arrow-left"></i>',
next: '<i class="icon-arrow-right"></i>'
2013-02-26 04:30:24 +01:00
},
events: this.getEvents
});
2013-02-25 01:00:17 +01:00
2013-02-26 04:30:24 +01:00
NzbDrone.Calendar.CalendarCollectionView.Instance = this;
$(this.ui.calendar).fullCalendar('addEventSource', this.calendar.toJSON());
},
2013-02-26 04:30:24 +01:00
getEvents: function(start, end, callback){
var bbView = NzbDrone.Calendar.CalendarCollectionView.Instance;
bbView.calendar.fetch({
data:{ start: Date.create(start).format(Date.ISO8601_DATETIME), end: Date.create(end).format(Date.ISO8601_DATETIME) },
success:function (calendarCollection) {
callback(calendarCollection.toJSON());
}
});
}
});
});