[Rt-commit] rt branch, 4.0/datetimepicker-ui, updated. rt-4.0.2-113-g6f5787e

Thomas Sibley trs at bestpractical.com
Fri Feb 3 14:04:27 EST 2012


The branch, 4.0/datetimepicker-ui has been updated
       via  6f5787e9a70fb8a473b059cd0c430ff0bdb2f725 (commit)
      from  75ad9e006125952c1c7c1f65ec92c6ae2ac08a3e (commit)

Summary of changes:
 share/html/NoAuth/js/jquery-ui-patch-datepicker.js |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 6f5787e9a70fb8a473b059cd0c430ff0bdb2f725
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Feb 3 14:01:09 2012 -0500

    Don't shift the datetime picker up if it would hit the bottom
    
    Shifting it up weirdly covers up the input and sometimes runs into
    z-index problems with the aileron menus.
    
    The datetime picker now extends past the viewport bottom and will push
    the page taller if it hits the page bottom.  This requires a short
    scroll, but is preferable to inconsistent and awful looking alignment
    otherwise.

diff --git a/share/html/NoAuth/js/jquery-ui-patch-datepicker.js b/share/html/NoAuth/js/jquery-ui-patch-datepicker.js
index 6eca467..38d537a 100644
--- a/share/html/NoAuth/js/jquery-ui-patch-datepicker.js
+++ b/share/html/NoAuth/js/jquery-ui-patch-datepicker.js
@@ -58,4 +58,23 @@
 
         return data;
     };
+
+    $.datepicker._checkOffset_orig = $.datepicker._checkOffset;
+    $.datepicker._checkOffset = function(inst, offset, isFixed) {
+        // copied from the original
+        var dpHeight    = inst.dpDiv.outerHeight();
+        var inputHeight = inst.input ? inst.input.outerHeight() : 0;
+        var viewHeight  = document.documentElement.clientHeight + $(document).scrollTop();
+
+        // save the original offset rather than the new offset because the
+        // original function modifies the passed arg as a side-effect
+        var old_offset = { top: offset.top, left: offset.left };
+        offset = $.datepicker._checkOffset_orig(inst, offset, isFixed);
+
+        // Negate any up or down positioning by adding instead of subtracting
+        offset.top += Math.min(old_offset.top, (old_offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+            Math.abs(dpHeight + inputHeight) : 0);
+
+        return offset;
+    };
 })(jQuery);

-----------------------------------------------------------------------


More information about the Rt-commit mailing list