un-unit-tested bugfixes for 1.2.1

This commit is contained in:
Adam Shaw 2009-06-29 05:36:29 +00:00
parent de10f54efb
commit 9a06943f52
4 changed files with 55 additions and 22 deletions

View file

@ -398,6 +398,7 @@ when creating a custom event source:
* **h** - 01 through 12 (hour, leading zeros) * **h** - 01 through 12 (hour, leading zeros)
* **H** - 00 through 23 (hour, military time and leading zeros) * **H** - 00 through 23 (hour, military time and leading zeros)
* **i** - 00 to 59 (minute, leading zeros) * **i** - 00 to 59 (minute, leading zeros)
* **c** - 2009-06-07T05:28:21Z (ISO8601)
**$.fullCalendar.parseDate(string)** **$.fullCalendar.parseDate(string)**
Parse a string and return a javascript Date object. The string may be Parse a string and return a javascript Date object. The string may be

View file

@ -13,3 +13,4 @@
{% block body %}{% endblock %} {% block body %}{% endblock %}
<? end_content() ?> <? end_content() ?>
<? fullcalendar_side() ?>

View file

@ -230,13 +230,9 @@
addEventSource: function(src) { addEventSource: function(src) {
eventSources.push(src); eventSources.push(src);
if (options.loading) { pushLoading();
options.loading(true);
}
fetchEventSource(src, function() { fetchEventSource(src, function() {
if (options.loading) { popLoading();
options.loading(false);
}
clearEventElements(); clearEventElements();
renderEvents(); renderEvents();
}); });
@ -974,17 +970,13 @@
var queued = eventSources.length; var queued = eventSources.length;
var sourceDone = function() { var sourceDone = function() {
if (--queued == 0) { if (--queued == 0) {
if (options.loading) { popLoading();
options.loading(false);
}
if (callback) { if (callback) {
callback(events); callback(events);
} }
} }
}; };
if (options.loading) { pushLoading();
options.loading(true);
}
for (var i=0; i<eventSources.length; i++) { for (var i=0; i<eventSources.length; i++) {
fetchEventSource(eventSources[i], sourceDone); fetchEventSource(eventSources[i], sourceDone);
} }
@ -1027,6 +1019,25 @@
} }
//
// methods for reporting loading state
//
var loadingLevel = 0;
function pushLoading() {
if (!loadingLevel++ && options.loading) {
options.loading(true);
}
}
function popLoading() {
if (!--loadingLevel && options.loading) {
options.loading(false);
}
}
@ -1037,26 +1048,33 @@
// //
/*******************************************************************/ /*******************************************************************/
var e = this; var e = $(this);
var _e = this;
var resizeID = 0; var resizeID = 0;
$(window).resize(function() { // re-render table on window resize $(window).resize(function() { // re-render table on window resize
if (!ignoreResizes) { if (!ignoreResizes) {
var rid = ++resizeID; // add a delay var rid = ++resizeID; // add a delay
setTimeout(function() { setTimeout(function() {
if (rid == resizeID) { if (rid == resizeID) {
// if calendar is visible
if (e.css('display') != 'none') {
// if the month width changed // if the month width changed
if (monthElement.width() != monthElementWidth) { if (monthElement.width() != monthElementWidth) {
clearEventElements(); clearEventElements();
setCellSizes(); setCellSizes();
_renderEvents(); _renderEvents();
if (options.resize) options.resize.call(e); if (options.resize) options.resize.call(_e);
}
} }
} }
}, 200); }, 200);
} }
}); });
render(); // let's begin... // let's begin...
if (e.css('display') != 'none') {
render();
}
@ -1088,7 +1106,9 @@
event.start = $.fullCalendar.parseDate(event.start); event.start = $.fullCalendar.parseDate(event.start);
event._start = cloneDate(event.start); event._start = cloneDate(event.start);
event.end = $.fullCalendar.parseDate(event.end); event.end = $.fullCalendar.parseDate(event.end);
if (!event.end) event.end = addDays(cloneDate(event.start), 1); if (!event.end || event.end <= event.start) {
event.end = addDays(cloneDate(event.start), 1);
}
return event; return event;
} }

View file

@ -37,6 +37,17 @@
if (link.type == 'text/html') url = link.href; if (link.type == 'text/html') url = link.href;
}); });
var showTime = entry['gd$when'][0]['startTime'].indexOf('T') != -1; var showTime = entry['gd$when'][0]['startTime'].indexOf('T') != -1;
var classNames = [];
if (showTime) {
classNames.push('nobg');
}
if (options.className) {
if (typeof options.className == 'string') {
classNames.push(options.className);
}else{
classNames = classNames.concat(options.className);
}
}
events.push({ events.push({
id: entry['gCal$uid']['value'], id: entry['gCal$uid']['value'],
url: url, url: url,
@ -46,7 +57,7 @@
location: entry['gd$where'][0]['valueString'], location: entry['gd$where'][0]['valueString'],
description: entry['content']['$t'], description: entry['content']['$t'],
showTime: showTime, showTime: showTime,
className: [showTime ? 'nobg' : null, options.className], className: classNames,
draggable: draggable draggable: draggable
}); });
}); });