Use number input type for year in dateMenu
authorrobin <robinp.1273@gmail.com>
Mon, 17 Sep 2012 00:52:55 +0000 (02:52 +0200)
committerrobin <robinp.1273@gmail.com>
Mon, 17 Sep 2012 19:47:19 +0000 (21:47 +0200)
Use the HTML5 number input type for the year input field in the dateMenu (used on e.g. history pages), since a year is always a number :)
(There was once a year type proposed, but that didn't make it into HTML5)

Patchset 2: use Html::input instead of Xml::input (and change the other Xml's to self::)

Change-Id: If9ad28566abfc02a164367d7cdd6992939169c0a

includes/Xml.php

index 120312d..4a55d5e 100644 (file)
@@ -198,10 +198,11 @@ class Xml {
                } else {
                        $encYear = '';
                }
-               return Xml::label( wfMessage( 'year' )->text(), 'year' ) . ' '.
-                       Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) . ' '.
-                       Xml::label( wfMessage( 'month' )->text(), 'month' ) . ' '.
-                       Xml::monthSelector( $encMonth, -1 );
+               $inputAttribs = array( 'id' => 'year', 'maxlength' => 4, 'size' => 7 );
+               return self::label( wfMessage( 'year' )->text(), 'year' ) . ' '.
+                       Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' '.
+                       self::label( wfMessage( 'month' )->text(), 'month' ) . ' '.
+                       self::monthSelector( $encMonth, -1 );
        }
 
        /**