Fixed #11314 - Highlight the current date in the admin calendar widget.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b59d6212b1
commit
7c3387ae3a
|
@ -46,6 +46,12 @@ var CalendarNamespace = {
|
||||||
return days;
|
return days;
|
||||||
},
|
},
|
||||||
draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999
|
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);
|
month = parseInt(month);
|
||||||
year = parseInt(year);
|
year = parseInt(year);
|
||||||
var calDiv = document.getElementById(div_id);
|
var calDiv = document.getElementById(div_id);
|
||||||
|
@ -76,7 +82,13 @@ var CalendarNamespace = {
|
||||||
if (i%7 == 0 && currentDay != 1) {
|
if (i%7 == 0 && currentDay != 1) {
|
||||||
tableRow = quickElement('tr', tableBody);
|
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+'));');
|
quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));');
|
||||||
currentDay++;
|
currentDay++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue