Adam Shaw 16 лет назад
Родитель
Сommit
d1bc5dc529
13 измененных файлов с 64 добавлено и 30 удалено
  1. 3 1
      Makefile
  2. 2 1
      changelog.txt
  3. 15 4
      src/agenda.js
  4. 4 1
      src/css/main.css
  5. 1 1
      src/grid.js
  6. 7 2
      src/main.js
  7. 0 2
      src/misc/head.txt
  8. 1 1
      src/util.js
  9. 6 3
      tests/locale.html
  10. 5 3
      tests/methods.html
  11. 6 7
      tests/options.html
  12. 12 3
      tests/theming.html
  13. 2 1
      tests/triggers.html

+ 3 - 1
Makefile

@@ -6,12 +6,14 @@ REV = `svn info | grep Rev: | sed 's/.*: //g'`
 JS_SRC_FILES =\
 JS_SRC_FILES =\
 	main.js\
 	main.js\
 	grid.js\
 	grid.js\
+	agenda.js\
 	view.js\
 	view.js\
 	util.js
 	util.js
 	
 	
 CSS_SRC_FILES =\
 CSS_SRC_FILES =\
 	main.css\
 	main.css\
-	grid.css
+	grid.css\
+	agenda.css
 
 
 OTHER_FILES =\
 OTHER_FILES =\
 	src/gcal.js\
 	src/gcal.js\

+ 2 - 1
changelog.txt

@@ -1,6 +1,6 @@
 
 
 version 1.4 (10/19/09)
 version 1.4 (10/19/09)
-	- agendaWeek and agendaDay views !!!
+	- agendaWeek and agendaDay views
 	- added some options for agenda views:
 	- added some options for agenda views:
 		- allDaySlot
 		- allDaySlot
 		- allDayText
 		- allDayText
@@ -16,6 +16,7 @@ version 1.4 (10/19/09)
 	- added 'prevYear' and 'nextYear' for buttons in header
 	- added 'prevYear' and 'nextYear' for buttons in header
 	- minor change for theme users, ui-state-hover not applied to active/inactive buttons
 	- minor change for theme users, ui-state-hover not applied to active/inactive buttons
 	- added event-color-changing example in docs
 	- added event-color-changing example in docs
+	- better defaults for right-to-left themed button icons
 
 
 version 1.3.2 (10/13/09)
 version 1.3.2 (10/13/09)
 	- Bugfixes (please upgrade from 1.3.1!)
 	- Bugfixes (please upgrade from 1.3.1!)

+ 15 - 4
src/agenda.js

@@ -52,7 +52,7 @@ function Agenda(element, options, methods) {
 
 
 	var head, body, bodyContent, bodyTable, bg,
 	var head, body, bodyContent, bodyTable, bg,
 		colCnt,
 		colCnt,
-		axisWidth, colWidth, slotHeight, // todo: axisWidth -> axisWidth, slotHeight->slotHeight ?
+		axisWidth, colWidth, slotHeight,
 		cachedDaySegs, cachedSlotSegs,
 		cachedDaySegs, cachedSlotSegs,
 		tm, firstDay,
 		tm, firstDay,
 		rtl, dis, dit,  // day index sign / translate
 		rtl, dis, dit,  // day index sign / translate
@@ -229,7 +229,15 @@ function Agenda(element, options, methods) {
 		var d0 = new Date(1970, 0, 1),
 		var d0 = new Date(1970, 0, 1),
 			scrollDate = cloneDate(d0);
 			scrollDate = cloneDate(d0);
 		scrollDate.setHours(options.firstHour);
 		scrollDate.setHours(options.firstHour);
-		body.scrollTop(timePosition(d0, scrollDate) + 1); // +1 for the border
+		var go = function() {
+			body.scrollTop(timePosition(d0, scrollDate) + 1); // +1 for the border
+				// TODO: +1 doesn't apply when firstHour=0
+		}
+		if ($.browser.opera) {
+			setTimeout(go, 0); // opera 10 (and earlier?) needs this
+		}else{
+			go();
+		}
 	}
 	}
 	
 	
 	
 	
@@ -254,8 +262,7 @@ function Agenda(element, options, methods) {
 				.width('')
 				.width('')
 				.each(function() {
 				.each(function() {
 					axisWidth = Math.max(axisWidth, $(this).outerWidth());
 					axisWidth = Math.max(axisWidth, $(this).outerWidth());
-				})
-				.add(stripeTDs.eq(0)),
+				}),
 			axisWidth
 			axisWidth
 		);
 		);
 		
 		
@@ -273,6 +280,10 @@ function Agenda(element, options, methods) {
 		});
 		});
 		
 		
 		slotHeight = body.find('tr:first div').height() + 1;
 		slotHeight = body.find('tr:first div').height() + 1;
+		
+		// TODO:
+		//reportTBody(bodyTable.find('tbody'));
+		// Opera 9.25 doesn't detect the bug when called from agenda
 	}
 	}
 	
 	
 	function slotClick(ev) {
 	function slotClick(ev) {

+ 4 - 1
src/css/main.css

@@ -252,12 +252,15 @@ table.fc-header {
 	 *     color: red;
 	 *     color: red;
 	 *     }
 	 *     }
 	 */
 	 */
+	 
+.fc-event {
+	text-align: left;
+	}
 	
 	
 .fc-event a {
 .fc-event a {
 	overflow: hidden;
 	overflow: hidden;
 	font-size: .85em;
 	font-size: .85em;
 	text-decoration: none;
 	text-decoration: none;
-	text-align: left;
 	cursor: pointer;
 	cursor: pointer;
 	}
 	}
 	
 	

+ 1 - 1
src/grid.js

@@ -239,7 +239,7 @@ function Grid(element, options, methods) {
 		
 		
 		}
 		}
 		
 		
-		updateSize(); // BUG: quirky widths with weekMode:variable
+		updateSize();
 		fetchEvents(renderEvents);
 		fetchEvents(renderEvents);
 	
 	
 	};
 	};

+ 7 - 2
src/main.js

@@ -83,6 +83,10 @@ var rtlDefaults = {
 		next: ' ◄ ',
 		next: ' ◄ ',
 		prevYear: ' >> ',
 		prevYear: ' >> ',
 		nextYear: ' << '
 		nextYear: ' << '
+	},
+	buttonIcons: {
+		prev: 'circle-triangle-e',
+		next: 'circle-triangle-w'
 	}
 	}
 };
 };
 
 
@@ -560,8 +564,7 @@ $.fn.fullCalendar = function(options) {
 						tr.append("<td><span class='fc-header-space'/></td>");
 						tr.append("<td><span class='fc-header-space'/></td>");
 					}
 					}
 					var prevButton;
 					var prevButton;
-					$.each(this.split(','), function(j) {
-						var buttonName = this; // TODO: make this an arg one line above
+					$.each(this.split(','), function(j, buttonName) {
 						if (buttonName == 'title') {
 						if (buttonName == 'title') {
 							tr.append("<td><h2 class='fc-header-title'/></td>");
 							tr.append("<td><h2 class='fc-header-title'/></td>");
 							if (prevButton) {
 							if (prevButton) {
@@ -658,6 +661,8 @@ $.fn.fullCalendar = function(options) {
 					overflow: 'hidden',
 					overflow: 'hidden',
 					height: Math.round(content.width() / options.aspectRatio)
 					height: Math.round(content.width() / options.aspectRatio)
 				});
 				});
+				// TODO: previous action might have caused scrollbars
+				// which will make the window width more narrow, possibly changing the aspect ratio
 			}
 			}
 		}
 		}
 		
 		

+ 0 - 2
src/misc/head.txt

@@ -11,8 +11,6 @@
  *   http://www.opensource.org/licenses/mit-license.php
  *   http://www.opensource.org/licenses/mit-license.php
  *   http://www.gnu.org/licenses/gpl.html
  *   http://www.gnu.org/licenses/gpl.html
  *
  *
- * Date:
- * Revision:
  */
  */
  
  
 (function($) {
 (function($) {

+ 1 - 1
src/util.js

@@ -276,7 +276,7 @@ function setOuterHeight(element, height, includeMargins) {
 
 
 var operaPositionBug;
 var operaPositionBug;
 
 
-function reportTBody(tbody) { // TODO: have agenda use this too
+function reportTBody(tbody) {
 	if (operaPositionBug == undefined) {
 	if (operaPositionBug == undefined) {
 		operaPositionBug = tbody.position().top != tbody.find('tr').position().top;
 		operaPositionBug = tbody.position().top != tbody.find('tr').position().top;
 	}
 	}

+ 6 - 3
tests/locale.html

@@ -31,13 +31,15 @@
 			
 			
 			weekMode: 'variable',
 			weekMode: 'variable',
 			
 			
-			dayClick: function(dayDate, view) {
-				console.log('dayClick - ' + dayDate + ' - ' + view.title);
+			dayClick: function(dayDate, allDay, ev, view) {
+				console.log('dayClick - ' + dayDate + ' - allDay:' + allDay + ' --- ' + view.title);
 			},
 			},
 			
 			
-			eventDrop: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
+			eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
 				console.log('DROP ' + event.title);
 				console.log('DROP ' + event.title);
 				console.log(dayDelta + ' days');
 				console.log(dayDelta + ' days');
+				console.log(minuteDelta + ' minutes');
+				console.log('allDay: ' + allDay);
 				console.log(event.start);
 				console.log(event.start);
 				//console.log(minuteDelta + ' minutes');
 				//console.log(minuteDelta + ' minutes');
 			},
 			},
@@ -45,6 +47,7 @@
 			eventResize: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
 			eventResize: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
 				console.log('RESIZE!! ' + event.title);
 				console.log('RESIZE!! ' + event.title);
 				console.log(dayDelta + ' days');
 				console.log(dayDelta + ' days');
+				console.log(minuteDelta + ' minutes');
 				console.log(event.end);
 				console.log(event.end);
 				//console.log(minuteDelta + ' minutes');
 				//console.log(minuteDelta + ' minutes');
 			},
 			},

+ 5 - 3
tests/methods.html

@@ -78,8 +78,10 @@
 	
 	
 	function updateEventStart() {
 	function updateEventStart() {
 		var event = cal.fullCalendar('clientEvents', 777)[0];
 		var event = cal.fullCalendar('clientEvents', 777)[0];
-		event.start = new Date(y, m, 25, 10, 30);
-		event.end = new Date(y, m, 26);
+		event.start = new Date(y, m, d, 13, 30);
+		event.end = new Date(y, m, d, 14, 50);
+		//event.start = new Date(y, m, 25, 10, 30); // move big days
+		//event.end = new Date(y, m, 26);
 		//event.allDay = true;
 		//event.allDay = true;
 		cal.fullCalendar('updateEvent', event);
 		cal.fullCalendar('updateEvent', event);
 	}
 	}
@@ -88,7 +90,7 @@
 		var event = cal.fullCalendar('clientEvents', 999)[0];
 		var event = cal.fullCalendar('clientEvents', 999)[0];
 		event.start = new Date(y, m, 4, 13, 30);
 		event.start = new Date(y, m, 4, 13, 30);
 		event.end = new Date(y, m, 5, 2, 0);
 		event.end = new Date(y, m, 5, 2, 0);
-		event.allDay = false;
+		event.allDay = true;
 		event.title = "repeat yo";
 		event.title = "repeat yo";
 		//event.editable = false;
 		//event.editable = false;
 		event.url = "http://google.com/";
 		event.url = "http://google.com/";

+ 6 - 7
tests/options.html

@@ -12,15 +12,14 @@
 	$(document).ready(function() {
 	$(document).ready(function() {
 		$('#calendar').fullCalendar({
 		$('#calendar').fullCalendar({
 		
 		
-			/*
-			year: 2010,
-			month: 0,
-			date: 0,
+			//year: 2010,
+			//month: 0,
+			//date: 1,
 			
 			
-			defaultView: 'basicDay',
+			//defaultView: 'basicDay',
+			
+			//aspectRatio: 1,
 			
 			
-			aspectRatio: 1,
-			*/
 			
 			
 			header: {
 			header: {
 				left: 'title',
 				left: 'title',

+ 12 - 3
tests/theming.html

@@ -16,19 +16,28 @@
 			theme: true,
 			theme: true,
 			editable: true,
 			editable: true,
 			
 			
-			//isRTL: true,
-			
 			header: {
 			header: {
-				left: 'prev,next today',
+				left: 'prevYear,prev,next,nextYear today',
 				center: 'title',
 				center: 'title',
 				right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
 				right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
 			},
 			},
 			
 			
+			/*
 			buttonIcons: {
 			buttonIcons: {
 				prev: 'triangle-1-w',
 				prev: 'triangle-1-w',
 				next: 'triangle-1-e',
 				next: 'triangle-1-e',
 				today: 'home'
 				today: 'home'
 			},
 			},
+			*/
+			
+			/*
+			isRTL: true,
+			header: {
+				left: 'nextYear,next,prev,prevYear today',
+				center: 'title',
+				right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
+			},
+			*/
 			
 			
 			events: [
 			events: [
 				{
 				{

+ 2 - 1
tests/triggers.html

@@ -141,7 +141,8 @@
 				{
 				{
 					id: 888,
 					id: 888,
 					title: 'Meeting',
 					title: 'Meeting',
-					start: new Date(y, m, d, 10, 30)
+					start: new Date(y, m, d, 10, 30),
+					allDay: false
 				},
 				},
 				{
 				{
 					id: 777,
 					id: 777,