Refs #25006 -- Added a '6 p.m.' option to the admin's time picker.

This commit is contained in:
Tim Graham 2015-06-20 19:47:15 -04:00
parent e7b4bd48c7
commit 7f155a0703
3 changed files with 13 additions and 0 deletions

View File

@ -124,6 +124,7 @@ var DateTimeShortcuts = {
// <li><a href="#">Midnight</a></li> // <li><a href="#">Midnight</a></li>
// <li><a href="#">6 a.m.</a></li> // <li><a href="#">6 a.m.</a></li>
// <li><a href="#">Noon</a></li> // <li><a href="#">Noon</a></li>
// <li><a href="#">6 p.m.</a></li>
// </ul> // </ul>
// <p class="calendar-cancel"><a href="#">Cancel</a></p> // <p class="calendar-cancel"><a href="#">Cancel</a></p>
// </div> // </div>
@ -143,6 +144,7 @@ var DateTimeShortcuts = {
quickElement("a", quickElement("li", time_list), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 0);"); quickElement("a", quickElement("li", time_list), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 0);");
quickElement("a", quickElement("li", time_list), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 6);"); quickElement("a", quickElement("li", time_list), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 6);");
quickElement("a", quickElement("li", time_list), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 12);"); quickElement("a", quickElement("li", time_list), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 12);");
quickElement("a", quickElement("li", time_list), gettext("6 p.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 18);");
var cancel_p = quickElement('p', clock_box); var cancel_p = quickElement('p', clock_box);
cancel_p.className = 'calendar-cancel'; cancel_p.className = 'calendar-cancel';

View File

@ -127,6 +127,7 @@ Minor features
applications for the current user, has been added to the applications for the current user, has been added to the
:meth:`AdminSite.each_context() <django.contrib.admin.AdminSite.each_context>` :meth:`AdminSite.each_context() <django.contrib.admin.AdminSite.each_context>`
method. method.
* :attr:`AdminSite.empty_value_display * :attr:`AdminSite.empty_value_display
<django.contrib.admin.AdminSite.empty_value_display>` and <django.contrib.admin.AdminSite.empty_value_display>` and
:attr:`ModelAdmin.empty_value_display :attr:`ModelAdmin.empty_value_display
@ -134,6 +135,9 @@ Minor features
the display of empty values in admin change list. You can also customize the the display of empty values in admin change list. You can also customize the
value for each field. value for each field.
* The time picker widget includes a '6 p.m' option for consistency of having
predefined options every 6 hours.
:mod:`django.contrib.auth` :mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -645,6 +645,13 @@ class DateTimePickerSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriv
# Check that the time picker is visible # Check that the time picker is visible
self.assertEqual( self.assertEqual(
self.get_css_value('#clockbox0', 'display'), 'block') self.get_css_value('#clockbox0', 'display'), 'block')
self.assertEqual(
[
x.text for x in
self.selenium.find_elements_by_xpath("//ul[@class='timelist']/li/a")
],
['Now', 'Midnight', '6 a.m.', 'Noon', '6 p.m.']
)
# Press the ESC key # Press the ESC key
self.selenium.find_element_by_tag_name('body').send_keys([Keys.ESCAPE]) self.selenium.find_element_by_tag_name('body').send_keys([Keys.ESCAPE])
# Check that the time picker is hidden again # Check that the time picker is hidden again