Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Explicitly removes dismissCalendar

Uses the removeEvent function in core.js to remove the dismissCalendar
function from the document click event.
Fixes #4045.
  • Loading branch information...
commit 5ab66dea50eab6625e3a07b71342268432e9cfaf 1 parent 4509a1b
@andrewjesaitis andrewjesaitis authored claudep committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
View
6 django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
@@ -7,6 +7,7 @@ var DateTimeShortcuts = {
calendarInputs: [],
clockInputs: [],
dismissClockFunc: [],
+ dismissCalendarFunc: [],
calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
calendarDivName2: 'calendarin', // name of <div> that contains calendar
calendarLinkName: 'calendarlink',// name of the link that is used to toggle
@@ -136,6 +137,7 @@ var DateTimeShortcuts = {
var num = DateTimeShortcuts.calendars.length;
DateTimeShortcuts.calendarInputs[num] = inp;
+ DateTimeShortcuts.dismissCalendarFunc[num] = function() { DateTimeShortcuts.dismissCalendar(num); return true; };
// Shortcut links (calendar icon and "Today" link)
var shortcuts_span = document.createElement('span');
@@ -243,11 +245,11 @@ var DateTimeShortcuts = {
cal_box.style.top = Math.max(0, findPosY(cal_link) - 75) + 'px';
cal_box.style.display = 'block';
- addEvent(window.document, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; });
+ addEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
},
dismissCalendar: function(num) {
document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none';
- window.document.onclick = null;
+ removeEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
},
drawPrev: function(num) {
DateTimeShortcuts.calendars[num].drawPreviousMonth();
Please sign in to comment.
Something went wrong with that request. Please try again.