Browse Source

kill convertFootprintToLegacySelection

Adam Shaw 8 years ago
parent
commit
ef21085e09
3 changed files with 12 additions and 17 deletions
  1. 2 2
      src/Calendar.constraints.js
  2. 1 1
      src/common/View.js
  3. 9 14
      src/models/ComponentFootprint.js

+ 2 - 2
src/Calendar.constraints.js

@@ -31,7 +31,7 @@ Calendar.prototype.isEventInstanceGroupAllowed = function(eventInstanceGroup) {
 		for (i = 0; i < eventFootprints.length; i++) {
 			if (
 				eventAllowFunc(
-					convertFootprintToLegacySelection(eventFootprints[i].componentFootprint, this),
+					eventFootprints[i].componentFootprint.toLegacy(this),
 					eventFootprints[i].toLegacy()
 				) === false
 			) {
@@ -67,7 +67,7 @@ Calendar.prototype.isSelectionFootprintAllowed = function(componentFootprint) {
 		selectAllowFunc = this.opt('selectAllow');
 
 		if (selectAllowFunc) {
-			return selectAllowFunc(componentFootprint.toLegacy()) !== false;
+			return selectAllowFunc(componentFootprint.toLegacy(this)) !== false;
 		}
 		else {
 			return true;

+ 1 - 1
src/common/View.js

@@ -823,7 +823,7 @@ var View = FC.View = ChronoComponent.extend({
 	renderSelectionFootprint: function(footprint, ev) {
 		if (this.renderSelection) { // legacy method in custom view classes
 			this.renderSelection(
-				convertFootprintToLegacySelection(footprint, this.calendar)
+				footprint.toLegacy(this.calendar)
 			);
 		}
 		else {

+ 9 - 14
src/models/ComponentFootprint.js

@@ -14,21 +14,16 @@ var ComponentFootprint = FC.ComponentFootprint = Class.extend({
 	},
 
 
-	toLegacy: function() {
-		return this.unzonedRange.getRange();
-	}
-
-});
+	toLegacy: function(calendar) {
+		var start = calendar.moment(this.unzonedRange.startMs);
+		var end = calendar.moment(this.unzonedRange.endMs);
 
+		if (this.isAllDay) {
+			start.stripTime();
+			end.stripTime();
+		}
 
-function convertFootprintToLegacySelection(footprint, calendar) {
-	var start = calendar.moment(footprint.unzonedRange.startMs);
-	var end = calendar.moment(footprint.unzonedRange.endMs);
-
-	if (footprint.isAllDay) {
-		start.stripTime();
-		end.stripTime();
+		return { start: start, end: end };
 	}
 
-	return { start: start, end: end };
-}
+});