Files
fullcalendar/src/basic/BasicWeekView.js
T
2014-09-09 10:25:42 +01:00

42 lines
1.2 KiB
JavaScript

/* A week view with simple day cells running horizontally
----------------------------------------------------------------------------------------------------------------------*/
// TODO: a WeekView mixin for calculating dates and titles
fcViews.basicWeek = BasicWeekView; // register this view
function BasicWeekView(calendar) {
BasicView.call(this, calendar); // call the super-constructor
}
BasicWeekView.prototype = createObject(BasicView.prototype); // define the super-class
$.extend(BasicWeekView.prototype, {
name: 'basicWeek',
incrementDate: function(date, delta) {
return date.clone().stripTime().add(delta, 'weeks').startOf('week');
},
render: function(date) {
this.intervalStart = date.clone().stripTime().startOf('week');
this.intervalEnd = this.intervalStart.clone().add(1, 'weeks');
this.start = this.skipHiddenDays(this.intervalStart);
this.end = this.skipHiddenDays(this.intervalEnd, -1, true);
this.title = this.calendar.formatRange(
this.start,
this.end.clone().subtract(1), // make inclusive by subtracting 1 ms
this.opt('titleFormat'),
' \u2014 ' // emphasized dash
);
BasicView.prototype.render.call(this, 1, this.getCellsPerWeek(), false); // call the super-method
}
});