diff --git a/src/Calendar.js b/src/Calendar.js
index f3b9901..6de32f5 100644
--- a/src/Calendar.js
+++ b/src/Calendar.js
@@ -243,7 +243,7 @@ function Calendar(element, instanceOptions) {
EventManager.call(t, options);
- //ResourceManager.call(t, options);
+ ResourceManager.call(t, options);
var isFetchNeeded = t.isFetchNeeded;
var fetchEvents = t.fetchEvents;
diff --git a/src/agenda/AgendaView.js b/src/agenda/AgendaView.js
index a2cfbd8..5f4d797 100644
--- a/src/agenda/AgendaView.js
+++ b/src/agenda/AgendaView.js
@@ -1,430 +1,430 @@
-
-/* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically.
-----------------------------------------------------------------------------------------------------------------------*/
-// Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
-// Responsible for managing width/height.
-
-setDefaults({
- allDaySlot: true,
- allDayText: 'all-day',
-
- scrollTime: '06:00:00',
-
- slotDuration: '00:30:00',
-
- axisFormat: generateAgendaAxisFormat,
- timeFormat: {
- agenda: generateAgendaTimeFormat
- },
-
- minTime: '00:00:00',
- maxTime: '24:00:00',
- slotEventOverlap: true
-});
-
-var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
-
-
-function generateAgendaAxisFormat(options, langData) {
- return langData.longDateFormat('LT')
- .replace(':mm', '(:mm)')
- .replace(/(\Wmm)$/, '($1)') // like above, but for foreign langs
- .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
-}
-
-
-function generateAgendaTimeFormat(options, langData) {
- return langData.longDateFormat('LT')
- .replace(/\s*a$/i, ''); // remove trailing AM/PM
-}
-
-
-function AgendaView(calendar) {
- View.call(this, calendar); // call the super-constructor
-
- this.timeGrid = new TimeGrid(this);
-
- if (this.opt('allDaySlot')) { // should we display the "all-day" area?
- this.dayGrid = new DayGrid(this); // the all-day subcomponent of this view
-
- // the coordinate grid will be a combination of both subcomponents' grids
- this.coordMap = new ComboCoordMap([
- this.dayGrid.coordMap,
- this.timeGrid.coordMap
- ]);
- }
- else {
- this.coordMap = this.timeGrid.coordMap;
- }
-}
-
-
-AgendaView.prototype = createObject(View.prototype); // define the super-class
-$.extend(AgendaView.prototype, {
-
- timeGrid: null, // the main time-grid subcomponent of this view
- dayGrid: null, // the "all-day" subcomponent. if all-day is turned off, this will be null
-
- axisWidth: null, // the width of the time axis running down the side
-
- noScrollRowEls: null, // set of fake row elements that must compensate when scrollerEl has scrollbars
-
- // when the time-grid isn't tall enough to occupy the given height, we render an
underneath
- bottomRuleEl: null,
- bottomRuleHeight: null,
-
-
- /* Rendering
- ------------------------------------------------------------------------------------------------------------------*/
-
-
- // Renders the view into `this.el`, which has already been assigned.
- // `colCnt` has been calculated by a subclass and passed here.
- render: function(colCnt) {
-
- // needed for cell-to-date and date-to-cell calculations in View
- this.rowCnt = 1;
- this.colCnt = colCnt;
-
- this.el.addClass('fc-agenda-view').html(this.renderHtml());
-
- // the element that wraps the time-grid that will probably scroll
- this.scrollerEl = this.el.find('.fc-time-grid-container');
- this.timeGrid.coordMap.containerEl = this.scrollerEl; // don't accept clicks/etc outside of this
-
- this.timeGrid.el = this.el.find('.fc-time-grid');
- this.timeGrid.render();
-
- // the that sometimes displays under the time-grid
- this.bottomRuleEl = $('')
- .appendTo(this.timeGrid.el); // inject it into the time-grid
-
- if (this.dayGrid) {
- this.dayGrid.el = this.el.find('.fc-day-grid');
- this.dayGrid.render();
-
- // have the day-grid extend it's coordinate area over the dividing the two grids
- this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight();
- }
-
- this.noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)'); // fake rows not within the scroller
-
- View.prototype.render.call(this); // call the super-method
-
- this.resetScroll(); // do this after sizes have been set
- },
-
-
- // Make subcomponents ready for cleanup
- destroy: function() {
- this.timeGrid.destroy();
- if (this.dayGrid) {
- this.dayGrid.destroy();
- }
- View.prototype.destroy.call(this); // call the super-method
- },
-
-
- // Builds the HTML skeleton for the view.
- // The day-grid and time-grid components will render inside containers defined by this HTML.
- renderHtml: function() {
- return '' +
- '
';
- }
- },
-
-
- // Generates the HTML that goes before the all-day cells.
- // Queried by the DayGrid subcomponent when generating rows. Ordering depends on isRTL.
- dayIntroHtml: function() {
- return '' +
- '
';
- },
-
-
- // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
- slotBgIntroHtml: function() {
- return '
';
- },
-
-
- // Generates the HTML that goes before all other types of cells.
- // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
- // Queried by the TimeGrid and DayGrid subcomponents when generating rows. Ordering depends on isRTL.
- introHtml: function() {
- return '
';
- },
-
-
- // Generates an HTML attribute string for setting the width of the axis, if it is known
- axisStyleAttr: function() {
- if (this.axisWidth !== null) {
- return 'style="width:' + this.axisWidth + 'px"';
- }
- return '';
- },
-
-
- /* Dimensions
- ------------------------------------------------------------------------------------------------------------------*/
-
- updateSize: function(isResize) {
- if (isResize) {
- this.timeGrid.resize();
- }
- View.prototype.updateSize.call(this, isResize);
- },
-
-
- // Refreshes the horizontal dimensions of the view
- updateWidth: function() {
- // make all axis cells line up, and record the width so newly created axis cells will have it
- this.axisWidth = matchCellWidths(this.el.find('.fc-axis'));
- },
-
-
- // Adjusts the vertical dimensions of the view to the specified values
- setHeight: function(totalHeight, isAuto) {
- var eventLimit;
- var scrollerHeight;
-
- if (this.bottomRuleHeight === null) {
- // calculate the height of the rule the very first time
- this.bottomRuleHeight = this.bottomRuleEl.outerHeight();
- }
- this.bottomRuleEl.hide(); // .show() will be called later if this is necessary
-
- // reset all dimensions back to the original state
- this.scrollerEl.css('overflow', '');
- unsetScroller(this.scrollerEl);
- uncompensateScroll(this.noScrollRowEls);
-
- // limit number of events in the all-day area
- if (this.dayGrid) {
- this.dayGrid.destroySegPopover(); // kill the "more" popover if displayed
-
- eventLimit = this.opt('eventLimit');
- if (eventLimit && typeof eventLimit !== 'number') {
- eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
- }
- if (eventLimit) {
- this.dayGrid.limitRows(eventLimit);
- }
- }
-
- if (!isAuto) { // should we force dimensions of the scroll container, or let the contents be natural height?
-
- scrollerHeight = this.computeScrollerHeight(totalHeight);
- if (setPotentialScroller(this.scrollerEl, scrollerHeight)) { // using scrollbars?
-
- // make the all-day and header rows lines up
- compensateScroll(this.noScrollRowEls, getScrollbarWidths(this.scrollerEl));
-
- // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
- // and reapply the desired height to the scroller.
- scrollerHeight = this.computeScrollerHeight(totalHeight);
- this.scrollerEl.height(scrollerHeight);
-
- this.restoreScroll();
- }
- else { // no scrollbars
- // still, force a height and display the bottom rule (marks the end of day)
- this.scrollerEl.height(scrollerHeight).css('overflow', 'hidden'); // in case goes outside
- this.bottomRuleEl.show();
- }
- }
- },
-
-
- // Sets the scroll value of the scroller to the intial pre-configured state prior to allowing the user to change it.
- resetScroll: function() {
- var _this = this;
- var scrollTime = moment.duration(this.opt('scrollTime'));
- var top = this.timeGrid.computeTimeTop(scrollTime);
-
- // zoom can give weird floating-point values. rather scroll a little bit further
- top = Math.ceil(top);
-
- if (top) {
- top++; // to overcome top border that slots beyond the first have. looks better
- }
-
- function scroll() {
- _this.scrollerEl.scrollTop(top);
- }
-
- scroll();
- setTimeout(scroll, 0); // overrides any previous scroll state made by the browser
- },
-
-
- /* Events
- ------------------------------------------------------------------------------------------------------------------*/
-
-
- // Renders events onto the view and populates the View's segment array
- renderEvents: function(events) {
- var dayEvents = [];
- var timedEvents = [];
- var daySegs = [];
- var timedSegs;
- var i;
-
- // separate the events into all-day and timed
- for (i = 0; i < events.length; i++) {
- if (events[i].allDay) {
- dayEvents.push(events[i]);
- }
- else {
- timedEvents.push(events[i]);
- }
- }
-
- // render the events in the subcomponents
- timedSegs = this.timeGrid.renderEvents(timedEvents);
- if (this.dayGrid) {
- daySegs = this.dayGrid.renderEvents(dayEvents);
- }
-
- // the all-day area is flexible and might have a lot of events, so shift the height
- this.updateHeight();
-
- View.prototype.renderEvents.call(this, events); // call the super-method
- },
-
-
- // Retrieves all segment objects that are rendered in the view
- getSegs: function() {
- return this.timeGrid.getSegs().concat(
- this.dayGrid ? this.dayGrid.getSegs() : []
- );
- },
-
-
- // Unrenders all event elements and clears internal segment data
- destroyEvents: function() {
- View.prototype.destroyEvents.call(this); // do this before the grids' segs have been cleared
-
- // if destroyEvents is being called as part of an event rerender, renderEvents will be called shortly
- // after, so remember what the scroll value was so we can restore it.
- this.recordScroll();
-
- // destroy the events in the subcomponents
- this.timeGrid.destroyEvents();
- if (this.dayGrid) {
- this.dayGrid.destroyEvents();
- }
-
- // we DON'T need to call updateHeight() because:
- // A) a renderEvents() call always happens after this, which will eventually call updateHeight()
- // B) in IE8, this causes a flash whenever events are rerendered
- },
-
-
- /* Event Dragging
- ------------------------------------------------------------------------------------------------------------------*/
-
-
- // Renders a visual indication of an event being dragged over the view.
- // A returned value of `true` signals that a mock "helper" event has been rendered.
- renderDrag: function(start, end, seg) {
- if (start.hasTime()) {
- return this.timeGrid.renderDrag(start, end, seg);
- }
- else if (this.dayGrid) {
- return this.dayGrid.renderDrag(start, end, seg);
- }
- },
-
-
- // Unrenders a visual indications of an event being dragged over the view
- destroyDrag: function() {
- this.timeGrid.destroyDrag();
- if (this.dayGrid) {
- this.dayGrid.destroyDrag();
- }
- },
-
-
- /* Selection
- ------------------------------------------------------------------------------------------------------------------*/
-
-
- // Renders a visual indication of a selection
- renderSelection: function(start, end) {
- if (start.hasTime() || end.hasTime()) {
- this.timeGrid.renderSelection(start, end);
- }
- else if (this.dayGrid) {
- this.dayGrid.renderSelection(start, end);
- }
- },
-
-
- // Unrenders a visual indications of a selection
- destroySelection: function() {
- this.timeGrid.destroySelection();
- if (this.dayGrid) {
- this.dayGrid.destroySelection();
- }
- }
-
-});
+
+/* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically.
+----------------------------------------------------------------------------------------------------------------------*/
+// Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
+// Responsible for managing width/height.
+
+setDefaults({
+ allDaySlot: true,
+ allDayText: 'all-day',
+
+ scrollTime: '06:00:00',
+
+ slotDuration: '00:30:00',
+
+ axisFormat: generateAgendaAxisFormat,
+ timeFormat: {
+ agenda: generateAgendaTimeFormat
+ },
+
+ minTime: '00:00:00',
+ maxTime: '24:00:00',
+ slotEventOverlap: true
+});
+
+var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
+
+
+function generateAgendaAxisFormat(options, langData) {
+ return langData.longDateFormat('LT')
+ .replace(':mm', '(:mm)')
+ .replace(/(\Wmm)$/, '($1)') // like above, but for foreign langs
+ .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
+}
+
+
+function generateAgendaTimeFormat(options, langData) {
+ return langData.longDateFormat('LT')
+ .replace(/\s*a$/i, ''); // remove trailing AM/PM
+}
+
+
+function AgendaView(calendar) {
+ View.call(this, calendar); // call the super-constructor
+
+ this.timeGrid = new TimeGrid(this);
+
+ if (this.opt('allDaySlot')) { // should we display the "all-day" area?
+ this.dayGrid = new DayGrid(this); // the all-day subcomponent of this view
+
+ // the coordinate grid will be a combination of both subcomponents' grids
+ this.coordMap = new ComboCoordMap([
+ this.dayGrid.coordMap,
+ this.timeGrid.coordMap
+ ]);
+ }
+ else {
+ this.coordMap = this.timeGrid.coordMap;
+ }
+}
+
+
+AgendaView.prototype = createObject(View.prototype); // define the super-class
+$.extend(AgendaView.prototype, {
+
+ timeGrid: null, // the main time-grid subcomponent of this view
+ dayGrid: null, // the "all-day" subcomponent. if all-day is turned off, this will be null
+
+ axisWidth: null, // the width of the time axis running down the side
+
+ noScrollRowEls: null, // set of fake row elements that must compensate when scrollerEl has scrollbars
+
+ // when the time-grid isn't tall enough to occupy the given height, we render an underneath
+ bottomRuleEl: null,
+ bottomRuleHeight: null,
+
+
+ /* Rendering
+ ------------------------------------------------------------------------------------------------------------------*/
+
+
+ // Renders the view into `this.el`, which has already been assigned.
+ // `colCnt` has been calculated by a subclass and passed here.
+ render: function(colCnt) {
+
+ // needed for cell-to-date and date-to-cell calculations in View
+ this.rowCnt = 1;
+ this.colCnt = colCnt;
+
+ this.el.addClass('fc-agenda-view').html(this.renderHtml());
+
+ // the element that wraps the time-grid that will probably scroll
+ this.scrollerEl = this.el.find('.fc-time-grid-container');
+ this.timeGrid.coordMap.containerEl = this.scrollerEl; // don't accept clicks/etc outside of this
+
+ this.timeGrid.el = this.el.find('.fc-time-grid');
+ this.timeGrid.render();
+
+ // the that sometimes displays under the time-grid
+ this.bottomRuleEl = $('')
+ .appendTo(this.timeGrid.el); // inject it into the time-grid
+
+ if (this.dayGrid) {
+ this.dayGrid.el = this.el.find('.fc-day-grid');
+ this.dayGrid.render();
+
+ // have the day-grid extend it's coordinate area over the dividing the two grids
+ this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight();
+ }
+
+ this.noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)'); // fake rows not within the scroller
+
+ View.prototype.render.call(this); // call the super-method
+
+ this.resetScroll(); // do this after sizes have been set
+ },
+
+
+ // Make subcomponents ready for cleanup
+ destroy: function() {
+ this.timeGrid.destroy();
+ if (this.dayGrid) {
+ this.dayGrid.destroy();
+ }
+ View.prototype.destroy.call(this); // call the super-method
+ },
+
+
+ // Builds the HTML skeleton for the view.
+ // The day-grid and time-grid components will render inside containers defined by this HTML.
+ renderHtml: function() {
+ return '' +
+ '
';
+ }
+ },
+
+
+ // Generates the HTML that goes before the all-day cells.
+ // Queried by the DayGrid subcomponent when generating rows. Ordering depends on isRTL.
+ dayIntroHtml: function() {
+ return '' +
+ '
';
+ },
+
+
+ // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
+ slotBgIntroHtml: function() {
+ return '
';
+ },
+
+
+ // Generates the HTML that goes before all other types of cells.
+ // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
+ // Queried by the TimeGrid and DayGrid subcomponents when generating rows. Ordering depends on isRTL.
+ introHtml: function() {
+ return '
';
+ },
+
+
+ // Generates an HTML attribute string for setting the width of the axis, if it is known
+ axisStyleAttr: function() {
+ if (this.axisWidth !== null) {
+ return 'style="width:' + this.axisWidth + 'px"';
+ }
+ return '';
+ },
+
+
+ /* Dimensions
+ ------------------------------------------------------------------------------------------------------------------*/
+
+ updateSize: function(isResize) {
+ if (isResize) {
+ this.timeGrid.resize();
+ }
+ View.prototype.updateSize.call(this, isResize);
+ },
+
+
+ // Refreshes the horizontal dimensions of the view
+ updateWidth: function() {
+ // make all axis cells line up, and record the width so newly created axis cells will have it
+ this.axisWidth = matchCellWidths(this.el.find('.fc-axis'));
+ },
+
+
+ // Adjusts the vertical dimensions of the view to the specified values
+ setHeight: function(totalHeight, isAuto) {
+ var eventLimit;
+ var scrollerHeight;
+
+ if (this.bottomRuleHeight === null) {
+ // calculate the height of the rule the very first time
+ this.bottomRuleHeight = this.bottomRuleEl.outerHeight();
+ }
+ this.bottomRuleEl.hide(); // .show() will be called later if this is necessary
+
+ // reset all dimensions back to the original state
+ this.scrollerEl.css('overflow', '');
+ unsetScroller(this.scrollerEl);
+ uncompensateScroll(this.noScrollRowEls);
+
+ // limit number of events in the all-day area
+ if (this.dayGrid) {
+ this.dayGrid.destroySegPopover(); // kill the "more" popover if displayed
+
+ eventLimit = this.opt('eventLimit');
+ if (eventLimit && typeof eventLimit !== 'number') {
+ eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
+ }
+ if (eventLimit) {
+ this.dayGrid.limitRows(eventLimit);
+ }
+ }
+
+ if (!isAuto) { // should we force dimensions of the scroll container, or let the contents be natural height?
+
+ scrollerHeight = this.computeScrollerHeight(totalHeight);
+ if (setPotentialScroller(this.scrollerEl, scrollerHeight)) { // using scrollbars?
+
+ // make the all-day and header rows lines up
+ compensateScroll(this.noScrollRowEls, getScrollbarWidths(this.scrollerEl));
+
+ // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
+ // and reapply the desired height to the scroller.
+ scrollerHeight = this.computeScrollerHeight(totalHeight);
+ this.scrollerEl.height(scrollerHeight);
+
+ this.restoreScroll();
+ }
+ else { // no scrollbars
+ // still, force a height and display the bottom rule (marks the end of day)
+ this.scrollerEl.height(scrollerHeight).css('overflow', 'hidden'); // in case goes outside
+ this.bottomRuleEl.show();
+ }
+ }
+ },
+
+
+ // Sets the scroll value of the scroller to the intial pre-configured state prior to allowing the user to change it.
+ resetScroll: function() {
+ var _this = this;
+ var scrollTime = moment.duration(this.opt('scrollTime'));
+ var top = this.timeGrid.computeTimeTop(scrollTime);
+
+ // zoom can give weird floating-point values. rather scroll a little bit further
+ top = Math.ceil(top);
+
+ if (top) {
+ top++; // to overcome top border that slots beyond the first have. looks better
+ }
+
+ function scroll() {
+ _this.scrollerEl.scrollTop(top);
+ }
+
+ scroll();
+ setTimeout(scroll, 0); // overrides any previous scroll state made by the browser
+ },
+
+
+ /* Events
+ ------------------------------------------------------------------------------------------------------------------*/
+
+
+ // Renders events onto the view and populates the View's segment array
+ renderEvents: function(events) {
+ var dayEvents = [];
+ var timedEvents = [];
+ var daySegs = [];
+ var timedSegs;
+ var i;
+
+ // separate the events into all-day and timed
+ for (i = 0; i < events.length; i++) {
+ if (events[i].allDay) {
+ dayEvents.push(events[i]);
+ }
+ else {
+ timedEvents.push(events[i]);
+ }
+ }
+
+ // render the events in the subcomponents
+ timedSegs = this.timeGrid.renderEvents(timedEvents);
+ if (this.dayGrid) {
+ daySegs = this.dayGrid.renderEvents(dayEvents);
+ }
+
+ // the all-day area is flexible and might have a lot of events, so shift the height
+ this.updateHeight();
+
+ // /View.prototype.renderEvents.call(this, events); // call the super-method
+ },
+
+
+ // Retrieves all segment objects that are rendered in the view
+ getSegs: function() {
+ return this.timeGrid.getSegs().concat(
+ this.dayGrid ? this.dayGrid.getSegs() : []
+ );
+ },
+
+
+ // Unrenders all event elements and clears internal segment data
+ destroyEvents: function() {
+ View.prototype.destroyEvents.call(this); // do this before the grids' segs have been cleared
+
+ // if destroyEvents is being called as part of an event rerender, renderEvents will be called shortly
+ // after, so remember what the scroll value was so we can restore it.
+ this.recordScroll();
+
+ // destroy the events in the subcomponents
+ this.timeGrid.destroyEvents();
+ if (this.dayGrid) {
+ this.dayGrid.destroyEvents();
+ }
+
+ // we DON'T need to call updateHeight() because:
+ // A) a renderEvents() call always happens after this, which will eventually call updateHeight()
+ // B) in IE8, this causes a flash whenever events are rerendered
+ },
+
+
+ /* Event Dragging
+ ------------------------------------------------------------------------------------------------------------------*/
+
+
+ // Renders a visual indication of an event being dragged over the view.
+ // A returned value of `true` signals that a mock "helper" event has been rendered.
+ renderDrag: function(start, end, seg) {
+ if (start.hasTime()) {
+ return this.timeGrid.renderDrag(start, end, seg);
+ }
+ else if (this.dayGrid) {
+ return this.dayGrid.renderDrag(start, end, seg);
+ }
+ },
+
+
+ // Unrenders a visual indications of an event being dragged over the view
+ destroyDrag: function() {
+ this.timeGrid.destroyDrag();
+ if (this.dayGrid) {
+ this.dayGrid.destroyDrag();
+ }
+ },
+
+
+ /* Selection
+ ------------------------------------------------------------------------------------------------------------------*/
+
+
+ // Renders a visual indication of a selection
+ renderSelection: function(start, end) {
+ if (start.hasTime() || end.hasTime()) {
+ this.timeGrid.renderSelection(start, end);
+ }
+ else if (this.dayGrid) {
+ this.dayGrid.renderSelection(start, end);
+ }
+ },
+
+
+ // Unrenders a visual indications of a selection
+ destroySelection: function() {
+ this.timeGrid.destroySelection();
+ if (this.dayGrid) {
+ this.dayGrid.destroySelection();
+ }
+ }
+
+});
diff --git a/src/resource/ResourceDayView.js b/src/resource/ResourceDayView.js
index 2992e23..5a94eae 100644
--- a/src/resource/ResourceDayView.js
+++ b/src/resource/ResourceDayView.js
@@ -1,34 +1,62 @@
-
-fcViews.resourceDay = ResourceDayView;
-
-function ResourceDayView(element, calendar) { // TODO: make a DayView mixin
- var t = this;
-
-
- // exports
- t.incrementDate = incrementDate;
- t.render = render;
-
- // imports
- ResourceView.call(t, element, calendar, 'resourceDay');
- var getResources = t.getResources;
-
- function incrementDate(date, delta) {
- var out = date.clone().stripTime().add(delta, 'days');
- out = t.skipHiddenDays(out, delta < 0 ? -1 : 1);
- return out;
- }
-
-
- function render(date) {
-
- t.start = t.intervalStart = date.clone().stripTime();
- t.end = t.intervalEnd = t.start.clone().add(1, 'days');
-
- t.title = calendar.formatDate(t.start, t.opt('titleFormat'));
-
- t.renderResource(getResources().length);
- }
-
-
-}
\ No newline at end of file
+
+/* A day view with an all-day cell area at the top, and a time grid below by resource
+----------------------------------------------------------------------------------------------------------------------*/
+
+fcViews.resourceDay = ResourceDayView;
+
+function ResourceDayView(calendar) { // TODO: make a ResourceView mixin
+ ResourceView.call(this, calendar); // call the super-constructor
+}
+
+ResourceDayView.prototype = createObject(ResourceView.prototype); // define the super-class
+$.extend(ResourceDayView.prototype, {
+
+ name: 'resourceDay',
+
+
+ incrementDate: function(date, delta) {
+ var out = date.clone().stripTime().add(delta, 'days');
+ out = this.skipHiddenDays(out, delta < 0 ? -1 : 1);
+ return out;
+ },
+
+
+ render: function(date) {
+ this.start = this.intervalStart = date.clone().stripTime();
+ this.end = this.intervalEnd = this.start.clone().add(1, 'days');
+
+ this.title = this.calendar.formatDate(this.start, this.opt('titleFormat'));
+
+ ResourceView.prototype.render.call(this, this.calendar.fetchResources().length); // call the super-method
+ },
+
+ // Computes HTML classNames for a single-day cell
+ getDayClasses: function(date) {
+ var view = this.view;
+ var today = view.calendar.getNow().stripTime();
+ var classes = [ 'fc-' + dayIDs[date.day()] ];
+
+ if (
+ view.name === 'month' &&
+ date.month() != view.intervalStart.month()
+ ) {
+ classes.push('fc-other-month');
+ }
+
+ if (date.isSame(today, 'day')) {
+ classes.push(
+ 'fc-todaysss',
+ view.highlightStateClass
+ );
+ }
+ else if (date < today) {
+ classes.push('fc-past');
+ }
+ else {
+ classes.push('fc-future');
+ }
+
+ return classes;
+ }
+
+});
\ No newline at end of file
diff --git a/src/resource/ResourceView.js b/src/resource/ResourceView.js
index c44cad3..6f970b5 100644
--- a/src/resource/ResourceView.js
+++ b/src/resource/ResourceView.js
@@ -1,1027 +1,84 @@
-
-setDefaults({
- allDaySlot: true,
- allDayText: 'all-day',
-
- scrollTime: '06:00:00',
-
- slotDuration: '00:30:00',
-
- axisFormat: generateAgendaAxisFormat,
- timeFormat: {
- resource: generateAgendaTimeFormat
- },
-
- dragOpacity: {
- resource: .5
- },
- minTime: '00:00:00',
- maxTime: '24:00:00',
- slotEventOverlap: true
-});
-
-
-// TODO: make it work in quirks mode (event corners, all-day height)
-// TODO: test liquid width, especially in IE6
-
-function ResourceView(element, calendar, viewName) {
- var t = this;
-
-
- // exports
- t.renderResource = renderResource;
- t.setWidth = setWidth;
- t.setHeight = setHeight;
- t.afterRender = afterRender;
- t.computeDateTop = computeDateTop;
- t.getIsCellAllDay = getIsCellAllDay;
- t.allDayRow = function() { return allDayRow; }; // badly named
- t.getCoordinateGrid = function() { return coordinateGrid; }; // specifically for AgendaEventRenderer
- t.getHoverListener = function() { return hoverListener; };
- t.colLeft = colLeft;
- t.colRight = colRight;
- t.colContentLeft = colContentLeft;
- t.colContentRight = colContentRight;
- t.getDaySegmentContainer = function() { return daySegmentContainer; };
- t.getSlotSegmentContainer = function() { return slotSegmentContainer; };
- t.getSlotContainer = function() { return slotContainer; };
- t.getRowCnt = function() { return 1; };
- t.getColCnt = function() { return 1; };
- t.getColWidth = function() { return colWidth; };
- t.getSnapHeight = function() { return snapHeight; };
- t.getSnapDuration = function() { return snapDuration; };
- t.getSlotHeight = function() { return slotHeight; };
- t.getSlotDuration = function() { return slotDuration; };
- t.getMinTime = function() { return minTime; };
- t.getMaxTime = function() { return maxTime; };
- t.defaultSelectionEnd = defaultSelectionEnd;
- t.renderDayOverlay = renderDayOverlay;
- t.renderSelection = renderSelection;
- t.clearSelection = clearSelection;
- t.reportDayClick = reportDayClick; // selection mousedown hack
- t.dragStart = dragStart;
- t.dragStop = dragStop;
- t.getResources = calendar.fetchResources;
-
- // imports
- View.call(t, element, calendar, viewName);
- t.eventDrop = eventDrop;
- t.eventResize = eventResize;
-
- OverlayManager.call(t);
- SelectionManager.call(t);
- ResourceEventRenderer.call(t);
- var opt = t.opt;
- var trigger = t.trigger;
- var renderOverlay = t.renderOverlay;
- var clearOverlays = t.clearOverlays;
- var reportSelection = t.reportSelection;
- var unselect = t.unselect;
- var slotSegHtml = t.slotSegHtml;
- var cellToDate = t.cellToDate;
- var dateToCell = t.dateToCell;
- var rangeToSegments = t.rangeToSegments;
- var formatDate = calendar.formatDate;
- var calculateWeekNumber = calendar.calculateWeekNumber;
- var reportEventChange = calendar.reportEventChange;
-
- // locals
-
- var dayTable;
- var dayHead;
- var dayHeadCells;
- var dayBody;
- var dayBodyCells;
- var dayBodyCellInners;
- var dayBodyCellContentInners;
- var dayBodyFirstCell;
- var dayBodyFirstCellStretcher;
- var slotLayer;
- var daySegmentContainer;
- var allDayTable;
- var allDayRow;
- var slotScroller;
- var slotContainer;
- var slotSegmentContainer;
- var slotTable;
- var selectionHelper;
-
- var viewWidth;
- var viewHeight;
- var axisWidth;
- var colWidth;
- var gutterWidth;
-
- var slotDuration;
- var slotHeight; // TODO: what if slotHeight changes? (see issue 650)
-
- var snapDuration;
- var snapRatio; // ratio of number of "selection" slots to normal slots. (ex: 1, 2, 4)
- var snapHeight; // holds the pixel hight of a "selection" slot
-
- var colCnt;
- var slotCnt;
- var coordinateGrid;
- var hoverListener;
- var colPositions;
- var colContentPositions;
- var slotTopCache = {};
-
- var tm;
- var rtl;
- var minTime;
- var maxTime;
- var colFormat;
- var resources = t.getResources;
-
- /* Rendering
- -----------------------------------------------------------------------------*/
-
-
- disableTextSelection(element.addClass('fc-agenda'));
-
-
- function renderResource(resourceColumnsCnt) {
- colCnt = resourceColumnsCnt;
- updateOptions();
-
- if (!dayTable) { // first time rendering?
- buildSkeleton(); // builds day table, slot area, events containers
- }
- else {
- buildDayTable(); // rebuilds day table
- }
- }
-
- function updateOptions() {
-
- tm = opt('theme') ? 'ui' : 'fc';
- rtl = opt('isRTL');
- colFormat = opt('columnFormat');
-
- minTime = moment.duration(opt('minTime'));
- maxTime = moment.duration(opt('maxTime'));
-
- slotDuration = moment.duration(opt('slotDuration'));
- snapDuration = opt('snapDuration');
- snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration;
- }
-
-
-
- /* Build DOM
- -----------------------------------------------------------------------*/
-
-
- function buildSkeleton() {
- var s;
- var headerClass = tm + "-widget-header";
- var contentClass = tm + "-widget-content";
- var slotTime;
- var slotDate;
- var minutes;
- var slotNormal = slotDuration.asMinutes() % 15 === 0;
-
- buildDayTable();
-
- slotLayer =
- $("")
- .appendTo(element);
-
- if (opt('allDaySlot')) {
-
- daySegmentContainer =
- $("")
- .appendTo(slotLayer);
-
- s =
- "
"
- );
-
- }else{
-
- daySegmentContainer = $([]); // in jQuery 1.4, we can just do $()
-
- }
-
- slotScroller =
- $("")
- .appendTo(slotLayer);
-
- slotContainer =
- $("")
- .appendTo(slotScroller);
-
- slotSegmentContainer =
- $("")
- .appendTo(slotContainer);
-
- s =
- "
" +
- "";
-
- slotTime = moment.duration(+minTime); // i wish there was .clone() for durations
- slotCnt = 0;
- while (slotTime < maxTime) {
- slotDate = t.start.clone().time(slotTime); // will be in UTC but that's good. to avoid DST issues
- minutes = slotDate.minutes();
- s +=
- "
" +
- "";
-
- return html;
- }
-
-
- function buildDayTableBodyHTML() {
- var headerClass = tm + "-widget-header"; // TODO: make these when updateOptions() called
- var contentClass = tm + "-widget-content";
- var date;
- var today = calendar.getNow().stripTime();
- var col;
- var cellsHTML;
- var cellHTML;
- var classNames;
- var html = '';
-
- html +=
- "" +
- "