Explorar o código

move business hour seg rendering into SegChronoComponentMixin

Adam Shaw %!s(int64=8) %!d(string=hai) anos
pai
achega
590bcc8b8e
Modificáronse 3 ficheiros con 56 adicións e 56 borrados
  1. 0 1
      src.json
  2. 0 55
      src/common/Grid.business-hours.js
  3. 56 0
      src/common/SegChronoComponentMixin.js

+ 0 - 1
src.json

@@ -27,7 +27,6 @@
     "common/Grid.js",
     "common/Grid.day-click.js",
     "common/Grid.day-selection.js",
-    "common/Grid.business-hours.js",
     "common/Grid.event-interaction.js",
     "common/Grid.event-dragging.js",
     "common/Grid.event-resizing.js",

+ 0 - 55
src/common/Grid.business-hours.js

@@ -1,55 +0,0 @@
-
-Grid.mixin({
-
-	// Generates an array of classNames to be used for the rendering business hours overlay. Called by the fill system.
-	// Called by fillSegHtml.
-	businessHoursSegClasses: function(seg) {
-		return [ 'fc-nonbusiness', 'fc-bgevent' ];
-	},
-
-
-	// Compute business hour segs for the grid's current date range.
-	// Caller must ask if whole-day business hours are needed.
-	buildBusinessHourSegs: function(wholeDay) {
-		return this.eventFootprintsToSegs(
-			this.buildBusinessHourEventFootprints(wholeDay)
-		);
-	},
-
-
-	// Compute business hour *events* for the grid's current date range.
-	// Caller must ask if whole-day business hours are needed.
-	// FOR RENDERING
-	buildBusinessHourEventFootprints: function(wholeDay) {
-		var calendar = this.view.calendar;
-
-		return this._buildBusinessHourEventFootprints(wholeDay, calendar.opt('businessHours'));
-	},
-
-
-	_buildBusinessHourEventFootprints: function(wholeDay, businessHourDef) {
-		var view = this.view;
-		var calendar = view.calendar;
-		var eventInstanceGroup;
-		var eventRanges;
-
-		eventInstanceGroup = calendar.buildBusinessInstanceGroup(
-			wholeDay,
-			businessHourDef,
-			view.renderUnzonedRange
-		);
-
-		if (eventInstanceGroup) {
-			eventRanges = eventInstanceGroup.sliceRenderRanges(
-				view.renderUnzonedRange,
-				calendar
-			);
-		}
-		else {
-			eventRanges = [];
-		}
-
-		return this.eventRangesToEventFootprints(eventRanges);
-	}
-
-});

+ 56 - 0
src/common/SegChronoComponentMixin.js

@@ -178,6 +178,62 @@ var SegChronoComponentMixin = $.extend({}, EventRenderingUtilsMixin, FillSystemM
 	},
 
 
+	/* Business Hours
+	------------------------------------------------------------------------------------------------------------------*/
+
+
+	// Compute business hour segs for the grid's current date range.
+	// Caller must ask if whole-day business hours are needed.
+	buildBusinessHourSegs: function(wholeDay) {
+		return this.eventFootprintsToSegs(
+			this.buildBusinessHourEventFootprints(wholeDay)
+		);
+	},
+
+
+	// Compute business hour *events* for the grid's current date range.
+	// Caller must ask if whole-day business hours are needed.
+	// FOR RENDERING
+	buildBusinessHourEventFootprints: function(wholeDay) {
+		var calendar = this.view.calendar;
+
+		return this._buildBusinessHourEventFootprints(wholeDay, calendar.opt('businessHours'));
+	},
+
+
+	_buildBusinessHourEventFootprints: function(wholeDay, businessHourDef) {
+		var view = this.view;
+		var calendar = view.calendar;
+		var eventInstanceGroup;
+		var eventRanges;
+
+		eventInstanceGroup = calendar.buildBusinessInstanceGroup(
+			wholeDay,
+			businessHourDef,
+			view.renderUnzonedRange
+		);
+
+		if (eventInstanceGroup) {
+			eventRanges = eventInstanceGroup.sliceRenderRanges(
+				view.renderUnzonedRange,
+				calendar
+			);
+		}
+		else {
+			eventRanges = [];
+		}
+
+		return this.eventRangesToEventFootprints(eventRanges);
+	},
+
+
+	// Generates an array of classNames to be used for the rendering business hours overlay.
+	// NEEDED BY FILL SYSTEM, fillSegHtml :(
+	businessHoursSegClasses: function(seg) {
+		return [ 'fc-nonbusiness', 'fc-bgevent' ];
+	},
+
+
 	/* Implement Highlight
 	------------------------------------------------------------------------------------------------------------------*/