Explorar o código

rename html-generating methods to render*

Adam Shaw %!s(int64=10) %!d(string=hai) anos
pai
achega
55e90dc983

+ 6 - 6
src/agenda/AgendaView.js

@@ -94,7 +94,7 @@ var AgendaView = fc.AgendaView = View.extend({
 	renderHead: function() {
 		this.headContainerEl =
 			this.el.find('.fc-head-container')
-				.html(this.timeGrid.getHeadHtml());
+				.html(this.timeGrid.renderHeadHtml());
 	},
 
 
@@ -396,7 +396,7 @@ var agendaTimeGridMethods = {
 
 
 	// Generates the HTML that will go before the day-of week header cells
-	getHeadIntroHtml: function() {
+	renderHeadIntroHtml: function() {
 		var view = this.view;
 		var weekText;
 
@@ -417,7 +417,7 @@ var agendaTimeGridMethods = {
 
 
 	// Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
-	getBgIntroHtml: function() {
+	renderBgIntroHtml: function() {
 		var view = this.view;
 
 		return '<td class="fc-axis ' + view.widgetContentClass + '" ' + view.axisStyleAttr() + '></td>';
@@ -426,7 +426,7 @@ var agendaTimeGridMethods = {
 
 	// Generates the HTML that goes before all other types of cells.
 	// Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
-	getIntroHtml: function() {
+	renderIntroHtml: function() {
 		var view = this.view;
 
 		return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
@@ -440,7 +440,7 @@ var agendaDayGridMethods = {
 
 
 	// Generates the HTML that goes before the all-day cells
-	getBgIntroHtml: function() {
+	renderBgIntroHtml: function() {
 		var view = this.view;
 
 		return '' +
@@ -454,7 +454,7 @@ var agendaDayGridMethods = {
 
 	// Generates the HTML that goes before all other types of cells.
 	// Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
-	getIntroHtml: function() {
+	renderIntroHtml: function() {
 		var view = this.view;
 
 		return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';

+ 5 - 5
src/basic/BasicView.js

@@ -83,7 +83,7 @@ var BasicView = fc.BasicView = View.extend({
 	renderHead: function() {
 		this.headContainerEl =
 			this.el.find('.fc-head-container')
-				.html(this.dayGrid.getHeadHtml());
+				.html(this.dayGrid.renderHeadHtml());
 		this.headRowEl = this.headContainerEl.find('.fc-row');
 	},
 
@@ -298,7 +298,7 @@ var basicDayGridMethods = {
 
 
 	// Generates the HTML that will go before the day-of week header cells
-	getHeadIntroHtml: function() {
+	renderHeadIntroHtml: function() {
 		var view = this.view;
 
 		if (view.weekNumbersVisible) {
@@ -315,7 +315,7 @@ var basicDayGridMethods = {
 
 
 	// Generates the HTML that will go before content-skeleton cells that display the day/week numbers
-	getNumberIntroHtml: function(row) {
+	renderNumberIntroHtml: function(row) {
 		var view = this.view;
 
 		if (view.weekNumbersVisible) {
@@ -332,7 +332,7 @@ var basicDayGridMethods = {
 
 
 	// Generates the HTML that goes before the day bg cells for each day-row
-	getBgIntroHtml: function() {
+	renderBgIntroHtml: function() {
 		var view = this.view;
 
 		if (view.weekNumbersVisible) {
@@ -346,7 +346,7 @@ var basicDayGridMethods = {
 
 	// Generates the HTML that goes before every other type of row generated by DayGrid.
 	// Affects helper-skeleton and highlight-skeleton rows.
-	getIntroHtml: function() {
+	renderIntroHtml: function() {
 		var view = this.view;
 
 		if (view.weekNumbersVisible) {

+ 13 - 13
src/common/DayGrid.js

@@ -27,7 +27,7 @@ var DayGrid = fc.DayGrid = Grid.extend($.extend({}, DayTableMixin, {
 		var col;
 
 		for (row = 0; row < rowCnt; row++) {
-			html += this.getDayRowHtml(row, isRigid);
+			html += this.renderDayRowHtml(row, isRigid);
 		}
 		this.el.html(html);
 
@@ -72,7 +72,7 @@ var DayGrid = fc.DayGrid = Grid.extend($.extend({}, DayTableMixin, {
 
 	// Generates the HTML for a single row, which is a div that wraps a table.
 	// `row` is the row number.
-	getDayRowHtml: function(row, isRigid) {
+	renderDayRowHtml: function(row, isRigid) {
 		var view = this.view;
 		var classes = [ 'fc-row', 'fc-week', view.widgetContentClass ];
 
@@ -84,14 +84,14 @@ var DayGrid = fc.DayGrid = Grid.extend($.extend({}, DayTableMixin, {
 			'<div class="' + classes.join(' ') + '">' +
 				'<div class="fc-bg">' +
 					'<table>' +
-						this.getBgTrHtml(row) +
+						this.renderBgTrHtml(row) +
 					'</table>' +
 				'</div>' +
 				'<div class="fc-content-skeleton">' +
 					'<table>' +
 						(this.numbersVisible ?
 							'<thead>' +
-								this.getNumberTrHtml(row) +
+								this.renderNumberTrHtml(row) +
 							'</thead>' :
 							''
 							) +
@@ -105,28 +105,28 @@ var DayGrid = fc.DayGrid = Grid.extend($.extend({}, DayTableMixin, {
 	------------------------------------------------------------------------------------------------------------------*/
 
 
-	getNumberTrHtml: function(row) {
+	renderNumberTrHtml: function(row) {
 		return '' +
 			'<tr>' +
-				(this.isRTL ? '' : this.getNumberIntroHtml(row)) +
-				this.getNumberCellsHtml(row) +
-				(this.isRTL ? this.getNumberIntroHtml(row) : '') +
+				(this.isRTL ? '' : this.renderNumberIntroHtml(row)) +
+				this.renderNumberCellsHtml(row) +
+				(this.isRTL ? this.renderNumberIntroHtml(row) : '') +
 			'</tr>';
 	},
 
 
-	getNumberIntroHtml: function(row) {
-		return this.getIntroHtml();
+	renderNumberIntroHtml: function(row) {
+		return this.renderIntroHtml();
 	},
 
 
-	getNumberCellsHtml: function(row) {
+	renderNumberCellsHtml: function(row) {
 		var htmls = [];
 		var col, date;
 
 		for (col = 0; col < this.colCnt; col++) {
 			date = this.getCellDate(row, col);
-			htmls.push(this.getNumberCellHtml(date));
+			htmls.push(this.renderNumberCellHtml(date));
 		}
 
 		return htmls.join('');
@@ -135,7 +135,7 @@ var DayGrid = fc.DayGrid = Grid.extend($.extend({}, DayTableMixin, {
 
 	// Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
 	// The number row will only exist if either day numbers or week numbers are turned on.
-	getNumberCellHtml: function(date) {
+	renderNumberCellHtml: function(date) {
 		var classes;
 
 		if (!this.view.dayNumbersVisible) { // if there are week numbers but not day numbers

+ 30 - 21
src/common/DayTableMixin.js

@@ -248,49 +248,49 @@ var DayTableMixin = fc.DayTableMixin = {
 	------------------------------------------------------------------------------------------------------------------*/
 
 
-	getHeadHtml: function() {
+	renderHeadHtml: function() {
 		var view = this.view;
 
 		return '' +
 			'<div class="fc-row ' + view.widgetHeaderClass + '">' +
 				'<table>' +
 					'<thead>' +
-						this.getHeadTrHtml() +
+						this.renderHeadTrHtml() +
 					'</thead>' +
 				'</table>' +
 			'</div>';
 	},
 
 
-	getHeadIntroHtml: function() {
-		return this.getIntroHtml(); // fall back to generic
+	renderHeadIntroHtml: function() {
+		return this.renderIntroHtml(); // fall back to generic
 	},
 
 
-	getHeadTrHtml: function() {
+	renderHeadTrHtml: function() {
 		return '' +
 			'<tr>' +
-				(this.isRTL ? '' : this.getHeadIntroHtml()) +
-				this.getHeadDateCellsHtml() +
-				(this.isRTL ? this.getHeadIntroHtml() : '') +
+				(this.isRTL ? '' : this.renderHeadIntroHtml()) +
+				this.renderHeadDateCellsHtml() +
+				(this.isRTL ? this.renderHeadIntroHtml() : '') +
 			'</tr>';
 	},
 
 
-	getHeadDateCellsHtml: function() {
+	renderHeadDateCellsHtml: function() {
 		var htmls = [];
 		var col, date;
 
 		for (col = 0; col < this.colCnt; col++) {
 			date = this.getCellDate(0, col);
-			htmls.push(this.getHeadDateCellHtml(date));
+			htmls.push(this.renderHeadDateCellHtml(date));
 		}
 
 		return htmls.join('');
 	},
 
 
-	getHeadDateCellHtml: function(date, colspan) {
+	renderHeadDateCellHtml: function(date, colspan) {
 		var view = this.view;
 
 		return '' +
@@ -306,35 +306,35 @@ var DayTableMixin = fc.DayTableMixin = {
 	------------------------------------------------------------------------------------------------------------------*/
 
 
-	getBgTrHtml: function(row) {
+	renderBgTrHtml: function(row) {
 		return '' +
 			'<tr>' +
-				(this.isRTL ? '' : this.getBgIntroHtml(row)) +
-				this.getBgCellsHtml(row) +
-				(this.isRTL ? this.getBgIntroHtml(row) : '') +
+				(this.isRTL ? '' : this.renderBgIntroHtml(row)) +
+				this.renderBgCellsHtml(row) +
+				(this.isRTL ? this.renderBgIntroHtml(row) : '') +
 			'</tr>';
 	},
 
 
-	getBgIntroHtml: function(row) {
-		return this.getIntroHtml(); // fall back to generic
+	renderBgIntroHtml: function(row) {
+		return this.renderIntroHtml(); // fall back to generic
 	},
 
 
-	getBgCellsHtml: function(row) {
+	renderBgCellsHtml: function(row) {
 		var htmls = [];
 		var col, date;
 
 		for (col = 0; col < this.colCnt; col++) {
 			date = this.getCellDate(row, col);
-			htmls.push(this.getBgCellHtml(date));
+			htmls.push(this.renderBgCellHtml(date));
 		}
 
 		return htmls.join('');
 	},
 
 
-	getBgCellHtml: function(date) {
+	renderBgCellHtml: function(date) {
 		var view = this.view;
 		var classes = this.getDayClasses(date);
 
@@ -346,6 +346,15 @@ var DayTableMixin = fc.DayTableMixin = {
 	},
 
 
+	/* Generic
+	------------------------------------------------------------------------------------------------------------------*/
+
+
+	// Generates the default HTML intro for any row. User classes should override
+	renderIntroHtml: function() {
+	},
+
+
 	/* Utils
 	------------------------------------------------------------------------------------------------------------------*/
 
@@ -353,7 +362,7 @@ var DayTableMixin = fc.DayTableMixin = {
 	// Applies the generic "intro" and "outro" HTML to the given cells.
 	// Intro means the leftmost cell when the calendar is LTR and the rightmost cell when RTL. Vice-versa for outro.
 	bookendCells: function(trEl) {
-		var introHtml = this.getIntroHtml();
+		var introHtml = this.renderIntroHtml();
 
 		if (introHtml) {
 			if (this.isRTL) {

+ 3 - 3
src/common/TimeGrid.js

@@ -59,19 +59,19 @@ var TimeGrid = fc.TimeGrid = Grid.extend($.extend({}, DayTableMixin, {
 		return '' +
 			'<div class="fc-bg">' +
 				'<table>' +
-					this.getBgTrHtml(0) + // row=0
+					this.renderBgTrHtml(0) + // row=0
 				'</table>' +
 			'</div>' +
 			'<div class="fc-slats">' +
 				'<table>' +
-					this.getSlatRowHtml() +
+					this.renderSlatRowHtml() +
 				'</table>' +
 			'</div>';
 	},
 
 
 	// Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
-	getSlatRowHtml: function() {
+	renderSlatRowHtml: function() {
 		var view = this.view;
 		var isRTL = this.isRTL;
 		var html = '';