Django

Code

Ticket #11414 (new)

Opened 7 months ago

Last modified 1 week ago

Calendar popup outside popup window in admin

Reported by: uipko Assigned to: nobody
Milestone: Component: django.contrib.admin
Version: 1.0 Keywords: calendar clock widget position popup
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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; });

Attachments

Change History

02/02/10 07:58:45 changed by russellm

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

Add/Change #11414 (Calendar popup outside popup window in admin)




Change Properties
Action