Browse Source

clean up use of stickySource

Adam Shaw 8 years ago
parent
commit
d665b58c6e
3 changed files with 7 additions and 5 deletions
  1. 1 1
      src/Calendar.constraints.js
  2. 1 1
      src/common/Grid.events.js
  3. 5 3
      src/models/EventManager.js

+ 1 - 1
src/Calendar.constraints.js

@@ -242,7 +242,7 @@ function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInst
 
 Calendar.prototype.parseEventDefToEventRanges = function(eventInput) {
 	var eventPeriod = this.eventManager.currentPeriod;
-	var eventDef = EventDefParser.parse(eventInput, this.eventManager.stickySource);
+	var eventDef = EventDefParser.parse(eventInput, new EventSource(this));
 
 	if (eventPeriod && eventDef) {
 		return eventInstancesToEventRanges(

+ 1 - 1
src/common/Grid.events.js

@@ -679,7 +679,7 @@ Grid.mixin({
 				start: start,
 				end: end
 			}),
-			calendar.eventManager.stickySource
+			new EventSource(calendar)
 		);
 
 		return eventDef;

+ 5 - 3
src/models/EventManager.js

@@ -3,13 +3,15 @@ var EventManager = Class.extend(EmitterMixin, ListenerMixin, {
 
 	currentPeriod: null,
 
-	stickySource: null, // TODO: move this into Calendar?
+	calendar: null,
+	stickySource: null,
 	otherSources: null, // does not include sticky source
 
 
 	constructor: function(calendar) {
-		this.otherSources = [];
+		this.calendar = calendar;
 		this.stickySource = new ArrayEventSource(calendar);
+		this.otherSources = [];
 	},
 
 
@@ -144,7 +146,7 @@ var EventManager = Class.extend(EmitterMixin, ListenerMixin, {
 		}
 
 		// parse as an event source
-		matchInput = EventSourceParser.parse(matchInput, this.stickySource.calendar); // ugh!!!
+		matchInput = EventSourceParser.parse(matchInput, this.calendar);
 		if (matchInput) {
 
 			return $.grep(sources, function(source) {