Opened 15 years ago

Closed 14 years ago

#11414 closed (fixed)

Calendar popup outside popup window in admin

Reported by: uipko Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords: calendar clock widget position popup
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This problem occurs when editing a object, in the admin, in a popup window. For example object A has a reference to object B, while editing object A I create a new object B by clicking on the green plus. Now I have a popup with object B.

When the first field is a date field the top of the calendar widget disappears. The problem is in the openCaledar function, the widget is moved up for 75px but there is no checked if this will give a negative position. The openClock function has the same calculation, probably this problem doesn't occur as quick for the clock because it is smaller.

The following patch will fix this problem for the calendar and clock widget.

--- Django-1.0.2-final/django/contrib/admin/media/js/admin/DateTimeShortcuts.js.distrib	2008-11-19 06:44:27.000000000 +0100
+++ Django-1.0.2-final/django/contrib/admin/media/js/admin/DateTimeShortcuts.js	2009-07-02 17:24:15.000000000 +0200
@@ -105,7 +105,7 @@
             //       (it returns as it was left aligned), needs to be fixed.
             clock_box.style.left = findPosX(clock_link) - 110 + 'px';
         }
-        clock_box.style.top = findPosY(clock_link) - 30 + 'px';
+        clock_box.style.top = Math.max(0, findPosY(clock_link) - 30) + 'px';
     
         // Show the clock box
         clock_box.style.display = 'block';
@@ -221,7 +221,7 @@
             //       (it returns as it was left aligned), needs to be fixed.
             cal_box.style.left = findPosX(cal_link) - 180 + 'px';
         }
-        cal_box.style.top = findPosY(cal_link) - 75 + 'px';
+        cal_box.style.top = Math.max(0, findPosY(cal_link) - 75) + 'px';
     
         cal_box.style.display = 'block';
         addEvent(window, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; });

Change History (2)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Ramiro Morales, 14 years ago

Resolution: fixed
Status: newclosed

(In [15143]) Fixed #11414 -- Made sure the calendar and clock popup windows in the admin don't have a negative vertical position. Thanks uipko for the report and fix.

Note: See TracTickets for help on using tickets.
Back to Top