Explorar o código

getEventTimeText uses eventFootprint now

Adam Shaw %!s(int64=8) %!d(string=hai) anos
pai
achega
f5d1ee026e

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

@@ -107,7 +107,7 @@ DayGrid.mixin({
 
 
 		// Only display a timed events time if it is the starting segment
 		// Only display a timed events time if it is the starting segment
 		if (seg.isStart) {
 		if (seg.isStart) {
-			timeText = this.getEventTimeText(event);
+			timeText = this.getEventTimeText(seg.footprint);
 			if (timeText) {
 			if (timeText) {
 				timeHtml = '<span class="fc-time">' + htmlEscape(timeText) + '</span>';
 				timeHtml = '<span class="fc-time">' + htmlEscape(timeText) + '</span>';
 			}
 			}

+ 20 - 5
src/common/Grid.events.js

@@ -873,7 +873,18 @@ Grid.mixin({
 	// If event times are disabled, or the event has no time, will return a blank string.
 	// If event times are disabled, or the event has no time, will return a blank string.
 	// If not specified, formatStr will default to the eventTimeFormat setting,
 	// If not specified, formatStr will default to the eventTimeFormat setting,
 	// and displayEnd will default to the displayEventEnd setting.
 	// and displayEnd will default to the displayEventEnd setting.
-	getEventTimeText: function(range, formatStr, displayEnd) {
+	getEventTimeText: function(eventFootprint, formatStr, displayEnd) {
+		return this._getEventTimeText(
+			eventFootprint.eventInstance.dateProfile.start,
+			eventFootprint.eventInstance.dateProfile.end,
+			eventFootprint.componentFootprint.isAllDay,
+			formatStr,
+			displayEnd
+		);
+	},
+
+
+	_getEventTimeText: function(start, end, isAllDay, formatStr, displayEnd) {
 
 
 		if (formatStr == null) {
 		if (formatStr == null) {
 			formatStr = this.eventTimeFormat;
 			formatStr = this.eventTimeFormat;
@@ -883,12 +894,16 @@ Grid.mixin({
 			displayEnd = this.displayEventEnd;
 			displayEnd = this.displayEventEnd;
 		}
 		}
 
 
-		if (this.displayEventTime && range.start.hasTime()) {
-			if (displayEnd && range.end) {
-				return this.view.formatRange(range, false, formatStr); // allDay=false
+		if (this.displayEventTime && !isAllDay) {
+			if (displayEnd && end) {
+				return this.view.formatRange(
+					{ start: start, end: end },
+					false, // allDay
+					formatStr
+				);
 			}
 			}
 			else {
 			else {
-				return range.start.format(formatStr);
+				return start.format(formatStr);
 			}
 			}
 		}
 		}
 
 

+ 11 - 8
src/common/TimeGrid.events.js

@@ -246,6 +246,8 @@ TimeGrid.mixin({
 	// Renders the HTML for a single event segment's default rendering
 	// Renders the HTML for a single event segment's default rendering
 	fgSegHtml: function(seg, disableResizing) {
 	fgSegHtml: function(seg, disableResizing) {
 		var view = this.view;
 		var view = this.view;
+		var componentFootprint = seg.footprint.componentFootprint;
+		var isAllDay = componentFootprint.isAllDay;
 		var event = seg.event;
 		var event = seg.event;
 		var isDraggable = view.isEventDraggable(event);
 		var isDraggable = view.isEventDraggable(event);
 		var isResizableFromStart = !disableResizing && seg.isStart && view.isEventResizableFromStart(event);
 		var isResizableFromStart = !disableResizing && seg.isStart && view.isEventResizableFromStart(event);
@@ -259,20 +261,21 @@ TimeGrid.mixin({
 		classes.unshift('fc-time-grid-event', 'fc-v-event');
 		classes.unshift('fc-time-grid-event', 'fc-v-event');
 
 
 		// if the event appears to span more than one day...
 		// if the event appears to span more than one day...
-		if (view.isMultiDayRange(seg.footprint.componentFootprint.unzonedRange)) {
+		if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
 			// Don't display time text on segments that run entirely through a day.
 			// Don't display time text on segments that run entirely through a day.
 			// That would appear as midnight-midnight and would look dumb.
 			// That would appear as midnight-midnight and would look dumb.
 			// Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
 			// Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
 			if (seg.isStart || seg.isEnd) {
 			if (seg.isStart || seg.isEnd) {
-				timeText = this.getEventTimeText(seg);
-				fullTimeText = this.getEventTimeText(seg, 'LT');
-				startTimeText = this.getEventTimeText(seg, null, false); // displayEnd=false
+				timeText = this._getEventTimeText(seg.start, seg.end, isAllDay);
+				fullTimeText = this._getEventTimeText(seg.start, seg.end, isAllDay, 'LT');
+				startTimeText = this._getEventTimeText(seg.start, seg.end, isAllDay, null, false); // displayEnd=false
 			}
 			}
-		} else {
+		}
+		else {
 			// Display the normal time text for the *event's* times
 			// Display the normal time text for the *event's* times
-			timeText = this.getEventTimeText(event);
-			fullTimeText = this.getEventTimeText(event, 'LT');
-			startTimeText = this.getEventTimeText(event, null, false); // displayEnd=false
+			timeText = this.getEventTimeText(seg.footprint);
+			fullTimeText = this.getEventTimeText(seg.footprint, 'LT');
+			startTimeText = this.getEventTimeText(seg.footprint, null, false); // displayEnd=false
 		}
 		}
 
 
 		return '<a class="' + classes.join(' ') + '"' +
 		return '<a class="' + classes.join(' ') + '"' +

+ 6 - 2
src/list/ListView.js

@@ -247,7 +247,11 @@ var ListViewGrid = Grid.extend({
 		// if the event appears to span more than one day
 		// if the event appears to span more than one day
 		else if (view.isMultiDayRange(seg.footprint.componentFootprint.unzonedRange)) {
 		else if (view.isMultiDayRange(seg.footprint.componentFootprint.unzonedRange)) {
 			if (seg.isStart || seg.isEnd) { // outer segment that probably lasts part of the day
 			if (seg.isStart || seg.isEnd) { // outer segment that probably lasts part of the day
-				timeHtml = htmlEscape(this.getEventTimeText(seg));
+				timeHtml = htmlEscape(this._getEventTimeText(
+					seg.start,
+					seg.end,
+					seg.footprint.componentFootprint.isAllDay
+				));
 			}
 			}
 			else { // inner segment that lasts the whole day
 			else { // inner segment that lasts the whole day
 				timeHtml = view.getAllDayHtml();
 				timeHtml = view.getAllDayHtml();
@@ -255,7 +259,7 @@ var ListViewGrid = Grid.extend({
 		}
 		}
 		else {
 		else {
 			// Display the normal time text for the *event's* times
 			// Display the normal time text for the *event's* times
-			timeHtml = htmlEscape(this.getEventTimeText(event));
+			timeHtml = htmlEscape(this.getEventTimeText(seg.footprint));
 		}
 		}
 
 
 		if (url) {
 		if (url) {