more bugfixes for 1.4

This commit is contained in:
Adam Shaw
2009-11-22 16:21:13 -08:00
parent 9db94207cb
commit 0cf59ac85c
7 changed files with 132 additions and 128 deletions
+14 -35
View File
@@ -210,15 +210,6 @@ $.fn.fullCalendar = function(options) {
});
unfixContentSize();
view.date = cloneDate(date);
if (header) {
// enable/disable 'today' button
var today = new Date();
if (today >= view.start && today < view.end) {
header.find('div.fc-button-today').addClass(tm + '-state-disabled');
}else{
header.find('div.fc-button-today').removeClass(tm + '-state-disabled');
}
}
}
else if (view.sizeDirty) {
view.updateSize();
@@ -233,6 +224,13 @@ $.fn.fullCalendar = function(options) {
if (header) {
// update title text
header.find('h2.fc-header-title').html(view.title);
// enable/disable 'today' button
var today = new Date();
if (today >= view.start && today < view.end) {
header.find('div.fc-button-today').addClass(tm + '-state-disabled');
}else{
header.find('div.fc-button-today').removeClass(tm + '-state-disabled');
}
}
view.sizeDirty = false;
view.eventsDirty = false;
@@ -574,8 +572,8 @@ $.fn.fullCalendar = function(options) {
prevButton.addClass(tm + '-no-right');
}
var button,
icon = options.theme ? viewOption(options, 'buttonIcons', buttonName) : null,
text = viewOption(options, 'buttonText', buttonName);
icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null,
text = smartProperty(options.buttonText, buttonName);
if (icon) {
button = $("<div class='fc-button-" + buttonName + " ui-state-default'>" +
"<a><span class='ui-icon ui-icon-" + icon + "'/></a></div>");
@@ -586,7 +584,11 @@ $.fn.fullCalendar = function(options) {
}
if (button) {
button
.click(buttonClick)
.click(function() {
if (!button.hasClass(tm + '-state-disabled')) {
buttonClick();
}
})
.mousedown(function() {
button.addClass(tm + '-state-down');
})
@@ -689,29 +691,6 @@ $.fn.fullCalendar = function(options) {
// TODO: rename
function viewOption(options, property, viewName) {
var v = options[property];
if (typeof v == 'object') {
if (v[viewName] != undefined) {
return v[viewName];
}
var parts = viewName.split(/(?=[A-Z])/),
i=parts.length-1, res;
for (; i>=0; i--) {
res = v[parts[i].toLowerCase()];
if (res != undefined) {
return res;
}
}
return v[''];
}
return v;
}
/* Important Event Utilities
-----------------------------------------------------------------------------*/