Sfoglia il codice sorgente

clean aspectRatio option, setting height right after init bugfix, ie6 button positioning bugfix, nixed cache option

Adam Shaw 16 anni fa
parent
commit
b61b9d5682

+ 1 - 1
src/agenda.js

@@ -68,7 +68,7 @@ function Agenda(element, options, methods) {
 	var head, body, bodyContent, bodyTable, bg,
 		colCnt,
 		axisWidth, colWidth, slotHeight,
-		cachedDaySegs, cachedSlotSegs,
+		cachedDaySegs=[], cachedSlotSegs=[],
 		cachedHeight,
 		tm, firstDay,
 		nwe,            // no weekends (int)

+ 0 - 1
src/css/main.css

@@ -101,7 +101,6 @@ table.fc-header {
 	
 .fc-header .fc-state-default a {
 	display: block;
-	position: relative;
 	border-width: 0 1px;
 	margin: 0 -1px;
 	width: 100%;

+ 1 - 1
src/grid.js

@@ -115,7 +115,7 @@ function Grid(element, options, methods) {
 		rowCnt, colCnt,
 		colWidth,
 		thead, tbody,
-		cachedSegs, //...
+		cachedSegs=[], //...
 		
 	// initialize superclass
 	view = $.extend(this, viewMethods, methods, {

+ 3 - 3
src/main.js

@@ -28,7 +28,6 @@ var defaults = {
 	// event ajax
 	startParam: 'start',
 	endParam: 'end',
-	cache: false,
 	
 	// time formats
 	titleFormat: {
@@ -304,7 +303,7 @@ $.fn.fullCalendar = function(options) {
 			else if (options.height) {
 				return options.height - (header ? header.height() : 0) - horizontalSides(content);
 			}
-			return elementWidth / options.aspectRatio;
+			return elementWidth / Math.max(options.aspectRatio, .5);
 		}
 		
 		
@@ -366,7 +365,7 @@ $.fn.fullCalendar = function(options) {
 					url: src,
 					dataType: 'json',
 					data: params,
-					cache: options.cache,
+					cache: false,
 					success: reportEventsAndPop
 				});
 			}
@@ -830,4 +829,5 @@ function normalizeEvent(event, options) {
 		event.className = [];
 	}
 }
+// TODO: if there is no title or start date, return false to indicate an invalid event
 

+ 1 - 0
src/util.js

@@ -109,6 +109,7 @@ var parseDate = fc.parseDate = function(s) {
 		}
 		return parseISO8601(s, true) || (s ? new Date(s) : null);
 	}
+	// TODO: never return invalid dates (like from new Date(<string>)), return null instead
 	return null;
 }
 

+ 51 - 0
tests/issue_220_buttons_ie6.html

@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+<script type='text/javascript'>DISABLE_FIREBUG_LITE=true</script>
+<script type='text/javascript' src='loader.js'></script>
+<script type='text/javascript'>
+
+	$(document).ready(function() {
+		
+		$('#calendar').fullCalendar({
+			header: {
+				left: 'prev,next today',
+				center: 'title',
+				right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
+			}
+		});
+		
+	});
+
+</script>
+<style type='text/css'>
+
+	body {
+		margin: 0;
+		font-size: 13px;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		}
+
+</style>
+</head>
+<body>
+<div style='height:108px;position:relative'></div>
+<div style='position:relative;margin-top:-50px;width:900px;z-index:2'>
+<div style='position:relative;padding:3px'>
+
+<div style='margin: 10px 20px 0'>Nav</div>
+
+<div style='margin:20px 0 0;padding:0 20px'>
+
+<p>
+this is a paragraph
+</p>
+
+<div id='calendar' style='margin:3em 0;direction:ltr'></div>
+
+</div>
+
+</div>
+</div>
+</body>
+</html>

+ 45 - 0
tests/issue_230_height_json_events.html

@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+<link rel='stylesheet' type='text/css' href='../examples/redmond/theme.css' />
+<script type='text/javascript' src='loader.js'></script>
+<script type='text/javascript'>
+
+	$(document).ready(function() {
+	
+		$('#calendar').fullCalendar({
+			year: 2009,
+			month: 10,
+			date: 22, 
+			//defaultView: 'agendaWeek', // error also occured with month view
+			editable: true,
+			events: "../examples/json-events.php"		
+		});
+		
+		$('#calendar').fullCalendar('option', 'height', $(window).height()-80);
+		// shouldn't throw an error
+		
+	});
+
+
+</script>
+<style type='text/css'>
+
+	body {
+		margin-top: 40px;
+		text-align: center;
+		font-size: 13px;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		}
+
+	#calendar {
+		width: 900px;
+		margin: 0 auto;
+		}
+
+</style>
+</head>
+<body>
+<div id='calendar'></div>
+</body>
+</html>

+ 44 - 0
tests/issue_244_aspectRatio_0.html

@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+<link rel='stylesheet' type='text/css' href='../examples/redmond/theme.css' />
+<script type='text/javascript' src='loader.js'></script>
+<script type='text/javascript'>
+
+	$(document).ready(function() {
+		
+		$('#calendar').fullCalendar({
+			header: {
+				left: 'prev,next today',
+				center: 'title',
+				right: 'month,agendaWeek,basicWeek,agendaDay,basicDay',
+			},
+			defaultView: 'agendaWeek', // month view also looked scrunched
+			aspectRatio: 0
+		});
+		
+		// shouldnt allow aspectRatios to *actually* go under .5
+		
+	});
+
+</script>
+<style type='text/css'>
+
+	body {
+		margin-top: 40px;
+		text-align: center;
+		font-size: 13px;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		}
+
+	#calendar {
+		width: 900px;
+		margin: 0 auto;
+		}
+
+</style>
+</head>
+<body>
+<div id='calendar'></div>
+</body>
+</html>

+ 3 - 1
tests/loader.js

@@ -85,7 +85,9 @@ if (_build) {
 	includeJS('../src/gcal.js');
 }
 
-includeJS('firebug-lite/firebug-lite-compressed.js');
+if (!window.DISABLE_FIREBUG_LITE) {
+	includeJS('firebug-lite/firebug-lite-compressed.js');
+}
 
 window.onload = function() {
 	$('body').append(