From d99ca24061d5e84a78d397f5129078417f01683e Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 18 Nov 2010 13:32:33 -0500 Subject: [PATCH] Multiple changes: Use a single handler each for swipeleft and right events. Avoids the issue where pageshow events do not fire on initial page load. Tweak CSS, add styling for "today" and the currently selected date in month view. --- kronolith/js/mobile.js | 191 ++++++++++++++++++------------ kronolith/templates/mobile/day.html.php | 2 +- kronolith/templates/mobile/month.html.php | 4 +- kronolith/themes/mobile.css | 14 ++- 4 files changed, 127 insertions(+), 84 deletions(-) diff --git a/kronolith/js/mobile.js b/kronolith/js/mobile.js index a24874f3e..c6f123620 100644 --- a/kronolith/js/mobile.js +++ b/kronolith/js/mobile.js @@ -38,7 +38,7 @@ /** * The currently displayed view - **/ + */ view: 'day', /** @@ -149,7 +149,11 @@ KronolithMobile.insertEvents(dates, view, data.cal); }, - //@TODO rename to renderView? + /** + * Inserts events into current view. + * For Day view, builds a new listview and attaches to the DOM. + * For Month view, hightlights dates with events. + */ insertEvents: function(dates, view, cal) { var date, events, list; @@ -189,10 +193,13 @@ date = day.dateString(); events = KronolithMobile.getCacheForDate(date, cal); $.each(events, function(key, event) { - $('#kronolithMonth' + date).addClass('kronolithSelected'); + $('#kronolithMonth' + date).addClass('kronolithContainsEvents'); }); day.next().day(); } + // Select current date. + $('#kronolithMonth'+ $('kronolithMinicalDate').data('date')).addClass('kronolithSelected'); + break; } }, @@ -280,7 +287,7 @@ buildEventView: function(e) { var list = $('