From 1245852e79ecc3422ffd8c7a2d0cd408c590b019 Mon Sep 17 00:00:00 2001 From: nbenitez Date: Tue, 25 Jan 2011 01:12:52 -0800 Subject: [PATCH 1/2] Fix render event when timeslotsPerHour is 1 If the slot is big enough (>25px) we show the two lines of text (Event time and title), if not then do current behaviour of only showing one line (event time). --- jquery.weekcalendar.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jquery.weekcalendar.js b/jquery.weekcalendar.js index 62a1ee8..65a3c84 100644 --- a/jquery.weekcalendar.js +++ b/jquery.weekcalendar.js @@ -1005,7 +1005,11 @@ var $newEvent = $("
"); - $newEvent.css({lineHeight: (options.timeslotHeight - 2) + "px", fontSize: (options.timeslotHeight / 2) + "px"}); + if (options.timeslotsPerHour == 1 && options.timeslotHeight > 25) { + $newEvent.css({lineHeight: ((options.timeslotHeight / 2)-1) + "px", fontSize: (options.timeslotHeight / 4) + "px"}); + } else { + $newEvent.css({lineHeight: (options.timeslotHeight - 2) + "px", fontSize: (options.timeslotHeight / 2) + "px"}); + } $target.append($newEvent); var columnOffset = $target.offset().top; From 1abc3c064904db6d01bdc94bba039e626cfc79ec Mon Sep 17 00:00:00 2001 From: nbenitez Date: Fri, 28 Jan 2011 00:44:27 -0800 Subject: [PATCH 2/2] Do comparison in milliseconds instead of microseconds Because of a strange +10 microseconds error over the correct value and so comparison fails --- full_demo/demo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/full_demo/demo.js b/full_demo/demo.js index c555de3..258ea7e 100644 --- a/full_demo/demo.js +++ b/full_demo/demo.js @@ -213,11 +213,11 @@ $(document).ready(function() { var startTime = timeslotTimes[i].start; var endTime = timeslotTimes[i].end; var startSelected = ""; - if (startTime.getTime() === calEvent.start.getTime()) { + if (Math.round(startTime.getTime()/1000) === Math.round(calEvent.start.getTime()/1000)) { startSelected = "selected=\"selected\""; } var endSelected = ""; - if (endTime.getTime() === calEvent.end.getTime()) { + if (Math.round(endTime.getTime()/1000) === Math.round(calEvent.end.getTime()/1000)) { endSelected = "selected=\"selected\""; } $startTimeField.append("");