Ticket #17064: 17064.improved-date-time-picker-ux.diff
File 17064.improved-date-time-picker-ux.diff, 3.7 KB (added by , 13 years ago) |
---|
-
django/contrib/admin/static/admin/css/widgets.css
diff --git a/django/contrib/admin/static/admin/css/widgets.css b/django/contrib/admin/static/admin/css/widgets.css index 3b5c31c..2989f2f 100644
a b span.clearable-file-input label { 379 379 380 380 .calendar-cancel { 381 381 margin: 0 !important; 382 padding: 0 ;382 padding: 0 !important; 383 383 font-size: 10px; 384 384 background: #e1e1e1 url(../img/nav-bg.gif) 0 50% repeat-x; 385 385 border-top: 1px solid #ddd; 386 386 } 387 387 388 .calendar-cancel:hover { 389 background: #e1e1e1 url(../img/nav-bg-reverse.gif) 0 50% repeat-x; 390 } 391 388 392 .calendar-cancel a { 389 padding: 2px;390 color: #999;393 color: black; 394 display: block; 391 395 } 392 396 393 397 ul.timelist, .timelist li { -
django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
diff --git a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js index f22cc7a..3ecc06f 100644
a b var DateTimeShortcuts = { 79 79 addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation); 80 80 81 81 quickElement('h2', clock_box, gettext('Choose a time')); 82 time_list = quickElement('ul', clock_box, '');82 var time_list = quickElement('ul', clock_box, ''); 83 83 time_list.className = 'timelist'; 84 time_format = get_format('TIME_INPUT_FORMATS')[0];84 var time_format = get_format('TIME_INPUT_FORMATS')[0]; 85 85 quickElement("a", quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().strftime('" + time_format + "'));"); 86 86 quickElement("a", quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date(1970,1,1,0,0,0,0).strftime('" + time_format + "'));"); 87 87 quickElement("a", quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date(1970,1,1,6,0,0,0).strftime('" + time_format + "'));"); 88 88 quickElement("a", quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date(1970,1,1,12,0,0,0).strftime('" + time_format + "'));"); 89 89 90 cancel_p = quickElement('p', clock_box, '');90 var cancel_p = quickElement('p', clock_box, ''); 91 91 cancel_p.className = 'calendar-cancel'; 92 92 quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');'); 93 django.jQuery(document).bind('keyup', function(event) { 94 if (event.which == 27) { 95 // ESC key closes popup 96 DateTimeShortcuts.dismissClock(num); 97 event.preventDefault(); 98 } 99 }); 93 100 }, 94 101 openClock: function(num) { 95 102 var clock_box = document.getElementById(DateTimeShortcuts.clockDivName+num) … … var DateTimeShortcuts = { 195 202 var cancel_p = quickElement('p', cal_box, ''); 196 203 cancel_p.className = 'calendar-cancel'; 197 204 quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');'); 205 django.jQuery(document).bind('keyup', function(event) { 206 if (event.which == 27) { 207 // ESC key closes popup 208 DateTimeShortcuts.dismissCalendar(num); 209 event.preventDefault(); 210 } 211 }); 198 212 }, 199 213 openCalendar: function(num) { 200 214 var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num)