Explorar el Código

query event rendering props from footprint, not seg

Adam Shaw hace 8 años
padre
commit
fa5c05706b

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

@@ -99,7 +99,7 @@ DayGrid.mixin({
 		var isResizableFromEnd = !disableResizing && isAllDay &&
 			seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
 		var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
-		var skinCss = cssToStr(this.getSegSkinCss(seg));
+		var skinCss = cssToStr(this.getEventFootprintSkinCss(seg.footprint));
 		var timeHtml = '';
 		var timeText;
 		var titleHtml;

+ 47 - 41
src/common/Grid.event-rendering.js

@@ -34,7 +34,7 @@ Grid.mixin({
 		var displayEventTime;
 		var displayEventEnd;
 
-		this.eventTimeFormat = // for Grid.event-rendering.js
+		this.eventTimeFormat =
 			this.opt('eventTimeFormat') ||
 			this.opt('timeFormat') || // deprecated
 			this.computeEventTimeFormat();
@@ -131,22 +131,17 @@ Grid.mixin({
 
 
 	// Generates an array of classNames to be used for the default rendering of a background event.
-	// Called by fillSegHtml.
+	// NEEDED BY FILL SYSTEM, fillSegHtml :(
 	bgEventSegClasses: function(seg) {
-		var eventDef = seg.footprint.eventDef;
-
-		return [ 'fc-bgevent' ].concat(
-			eventDef.className,
-			eventDef.source.className
-		);
+		return this.getBgEventFootprintClasses(seg.footprint);
 	},
 
 
 	// Generates a semicolon-separated CSS string to be used for the default rendering of a background event.
-	// Called by fillSegHtml.
+	// NEEDED BY FILL SYSTEM,  fillSegHtml :(
 	bgEventSegCss: function(seg) {
 		return {
-			'background-color': this.getSegSkinCss(seg)['background-color']
+			'background-color': this.getEventFootprintSkinCss(seg.footprint)['background-color']
 		};
 	},
 
@@ -205,7 +200,7 @@ Grid.mixin({
 			'fc-event',
 			seg.isStart ? 'fc-start' : 'fc-not-start',
 			seg.isEnd ? 'fc-end' : 'fc-not-end'
-		].concat(this.getSegCustomClasses(seg));
+		].concat(this.getEventFootprintClasses(seg.footprint));
 
 		if (isDraggable) {
 			classes.push('fc-draggable');
@@ -223,9 +218,21 @@ Grid.mixin({
 	},
 
 
-	// List of classes that were defined by the caller of the API in some way
-	getSegCustomClasses: function(seg) {
-		var eventDef = seg.footprint.eventDef;
+
+
+
+
+	getBgEventFootprintClasses: function(eventFootprint) {
+		var classNames = this.getEventFootprintClasses(eventFootprint);
+
+		classNames.push('fc-bgevent');
+
+		return classNames;
+	},
+
+
+	getEventFootprintClasses: function(eventFootprint) {
+		var eventDef = eventFootprint.eventDef;
 
 		return [].concat(
 			eventDef.className, // guaranteed to be an array
@@ -235,27 +242,25 @@ Grid.mixin({
 
 
 	// Utility for generating event skin-related CSS properties
-	getSegSkinCss: function(seg) {
+	getEventFootprintSkinCss: function(eventFootprint) {
 		return {
-			'background-color': this.getSegBackgroundColor(seg),
-			'border-color': this.getSegBorderColor(seg),
-			color: this.getSegTextColor(seg)
+			'background-color': this.getEventFootprintBackgroundColor(eventFootprint),
+			'border-color': this.getEventFootprintBorderColor(eventFootprint),
+			color: this.getEventFootprintTextColor(eventFootprint)
 		};
 	},
 
 
 	// Queries for caller-specified color, then falls back to default
-	getSegBackgroundColor: function(seg) {
-		var eventDef = seg.footprint.eventDef;
-
-		return eventDef.backgroundColor ||
-			eventDef.color ||
-			this.getSegDefaultBackgroundColor(seg);
+	getEventFootprintBackgroundColor: function(eventFootprint) {
+		return eventFootprint.eventDef.backgroundColor ||
+			eventFootprint.eventDef.color ||
+			this.getEventFootprintDefaultBackgroundColor(eventFootprint);
 	},
 
 
-	getSegDefaultBackgroundColor: function(seg) {
-		var source = seg.footprint.eventDef.source;
+	getEventFootprintDefaultBackgroundColor: function(eventFootprint) {
+		var source = eventFootprint.eventDef.source;
 
 		return source.backgroundColor ||
 			source.color ||
@@ -265,17 +270,15 @@ Grid.mixin({
 
 
 	// Queries for caller-specified color, then falls back to default
-	getSegBorderColor: function(seg) {
-		var eventDef = seg.footprint.eventDef;
-
-		return eventDef.borderColor ||
-			eventDef.color ||
-			this.getSegDefaultBorderColor(seg);
+	getEventFootprintBorderColor: function(eventFootprint) {
+		return eventFootprint.eventDef.borderColor ||
+			eventFootprint.eventDef.color ||
+			this.getEventFootprintDefaultBorderColor(eventFootprint);
 	},
 
 
-	getSegDefaultBorderColor: function(seg) {
-		var source = seg.footprint.eventDef.source;
+	getEventFootprintDefaultBorderColor: function(eventFootprint) {
+		var source = eventFootprint.eventDef.source;
 
 		return source.borderColor ||
 			source.color ||
@@ -285,22 +288,25 @@ Grid.mixin({
 
 
 	// Queries for caller-specified color, then falls back to default
-	getSegTextColor: function(seg) {
-		var eventDef = seg.footprint.eventDef;
-
-		return eventDef.textColor ||
-			this.getSegDefaultTextColor(seg);
+	getEventFootprintTextColor: function(eventFootprint) {
+		return eventFootprint.eventDef.textColor ||
+			this.getEventFootprintDefaultTextColor(eventFootprint);
 	},
 
 
-	getSegDefaultTextColor: function(seg) {
-		var source = seg.footprint.eventDef.source;
+	getEventFootprintDefaultTextColor: function(eventFootprint) {
+		var source = eventFootprint.eventDef.source;
 
 		return source.textColor ||
 			this.opt('eventTextColor');
 	},
 
 
+
+
+
+
+
 	sortEventSegs: function(segs) {
 		segs.sort(proxy(this, 'compareEventSegs'));
 	},

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

@@ -254,7 +254,7 @@ TimeGrid.mixin({
 		var isResizableFromStart = !disableResizing && seg.isStart && view.isEventDefResizableFromStart(eventDef);
 		var isResizableFromEnd = !disableResizing && seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
 		var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
-		var skinCss = cssToStr(this.getSegSkinCss(seg));
+		var skinCss = cssToStr(this.getEventFootprintSkinCss(seg.footprint));
 		var timeText;
 		var fullTimeText; // more verbose time text. for the print stylesheet
 		var startTimeText; // just the start time text

+ 2 - 2
src/list/ListView.js

@@ -251,12 +251,12 @@ var ListViewGrid = Grid.extend({
 		var view = this.view;
 		var calendar = view.calendar;
 		var theme = calendar.theme;
-		var classes = [ 'fc-list-item' ].concat(this.getSegCustomClasses(seg));
-		var bgColor = this.getSegBackgroundColor(seg);
 		var eventFootprint = seg.footprint;
 		var eventDef = eventFootprint.eventDef;
 		var componentFootprint = eventFootprint.componentFootprint;
 		var url = eventDef.url;
+		var classes = [ 'fc-list-item' ].concat(this.getEventFootprintClasses(seg.footprint));
+		var bgColor = this.getEventFootprintBackgroundColor(seg.footprint);
 		var timeHtml;
 
 		if (componentFootprint.isAllDay) {