Adam Shaw 8 år sedan
förälder
incheckning
8eb9162a53
3 ändrade filer med 20 tillägg och 21 borttagningar
  1. 9 7
      src/common/ChronoComponent.js
  2. 7 3
      src/common/Grid.js
  3. 4 11
      src/common/View.js

+ 9 - 7
src/common/ChronoComponent.js

@@ -14,6 +14,15 @@ var ChronoComponent = Model.extend({
 	highlightStateClass: null,
 
 
+	constructor: function() {
+		Model.call(this);
+
+		this.nextDayThreshold = moment.duration(this.opt('nextDayThreshold'));
+		this.isRTL = this.opt('isRTL');
+		this.initThemingProps();
+	},
+
+
 	// Options
 	// -----------------------------------------------------------------------------------------------------------------
 
@@ -23,13 +32,6 @@ var ChronoComponent = Model.extend({
 	},
 
 
-	processOptions: function() {
-		this.nextDayThreshold = moment.duration(this.opt('nextDayThreshold'));
-		this.isRTL = this.opt('isRTL');
-		this.initThemingProps();
-	},
-
-
 	// Initializes internal variables related to theming
 	initThemingProps: function() {
 		var tm = this.opt('theme') ? 'ui' : 'fc';

+ 7 - 3
src/common/Grid.js

@@ -13,7 +13,6 @@ var Grid = FC.Grid = ChronoComponent.extend({
 	start: null,
 	end: null,
 
-	el: null, // the containing element
 	elsByFill: null, // a hash of jQuery element sets used for rendering each fill. Keyed by fill name.
 
 	// derived from options
@@ -37,7 +36,9 @@ var Grid = FC.Grid = ChronoComponent.extend({
 
 	constructor: function(view) {
 		this.view = view;
-		this.isRTL = view.opt('isRTL');
+
+		ChronoComponent.call(this);
+
 		this.elsByFill = {};
 
 		this.dayClickListener = this.buildDayClickListener();
@@ -45,7 +46,10 @@ var Grid = FC.Grid = ChronoComponent.extend({
 	},
 
 
-	// TODO: opt()
+	// TODO: use everywhere
+	opt: function(name) {
+		return this.view.opt(name);
+	},
 
 
 	/* Options

+ 4 - 11
src/common/View.js

@@ -37,8 +37,6 @@ var View = FC.View = ChronoComponent.extend({
 
 
 	constructor: function(calendar, viewSpec) {
-		ChronoComponent.call(this);
-
 		this.calendar = calendar;
 		this.viewSpec = viewSpec;
 
@@ -49,7 +47,10 @@ var View = FC.View = ChronoComponent.extend({
 		// .name is deprecated
 		this.name = this.type;
 
-		this.processOptions();
+		ChronoComponent.call(this);
+
+		this.initHiddenDays();
+		this.eventOrderSpecs = parseFieldSpecs(this.opt('eventOrder'));
 
 		this.renderQueue = this.buildRenderQueue();
 		this.initAutoBatchRender();
@@ -58,14 +59,6 @@ var View = FC.View = ChronoComponent.extend({
 	},
 
 
-	processOptions: function() {
-		ChronoComponent.prototype.processOptions.apply(this, arguments);
-
-		this.initHiddenDays();
-		this.eventOrderSpecs = parseFieldSpecs(this.opt('eventOrder'));
-	},
-
-
 	buildRenderQueue: function() {
 		var _this = this;
 		var renderQueue = new RenderQueue({