Author: jezdez
Date: 2010-01-04 16:48:36 -0600 (Mon, 04 Jan 2010)
New Revision: 12089
Modified:
django/trunk/django/contrib/admin/media/js/calendar.js
Log:
Fixed #11314 - Highlight the current date in the admin calendar widget.
Modified: django/trunk/django/contrib/admin/media/js/calendar.js
===================================================================
--- django/trunk/django/contrib/admin/media/js/calendar.js 2010-01-04
22:47:52 UTC (rev 12088)
+++ django/trunk/django/contrib/admin/media/js/calendar.js 2010-01-04
22:48:36 UTC (rev 12089)
@@ -46,6 +46,12 @@
return days;
},
draw: function(month, year, div_id, callback) { // month = 1-12, year =
1-9999
+ var today = new Date();
+ var todayDay = today.getDate();
+ var todayMonth = today.getMonth()+1;
+ var todayYear = today.getFullYear();
+ var todayClass = '';
+
month = parseInt(month);
year = parseInt(year);
var calDiv = document.getElementById(div_id);
@@ -76,7 +82,13 @@
if (i%7 == 0 && currentDay != 1) {
tableRow = quickElement('tr', tableBody);
}
- var cell = quickElement('td', tableRow, '');
+ if ((currentDay==todayDay) && (month==todayMonth) &&
(year==todayYear)) {
+ todayClass='today';
+ } else {
+ todayClass='';
+ }
+ var cell = quickElement('td', tableRow, '', 'class', todayClass);
+
quickElement('a', cell, currentDay, 'href', 'javascript:void(' +
callback + '('+year+','+month+','+currentDay+'));');
currentDay++;
}
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.