Merge pull request #32 from open-sausages/pulls/4.0/6626-remove-jquery-datepicker

HTML5 date
This commit is contained in:
Damian Mooyman 2017-04-04 10:57:51 +12:00 committed by GitHub
commit b3301548ea

View File

@ -55,6 +55,7 @@ class BasicFieldsTestPage extends TestPage
'Text' => 'Varchar',
'Textarea' => 'Text',
'Time' => 'Time',
'TimeHTML5' => 'Time',
'ToggleCompositeTextField1' => 'Varchar',
'ToggleCompositeDropdownField' => 'Varchar',
'Validated' => 'Text',
@ -152,6 +153,7 @@ class BasicFieldsTestPage extends TestPage
'Text' => 'My value (ä!)',
'Textarea' => 'My value (ä!)',
'Time' => "23:59",
'TimeHTML5' => "23:59",
'ToggleCompositeTextField1' => 'My value (ä!)',
'Validated' => '1',
);
@ -190,8 +192,7 @@ class BasicFieldsTestPage extends TestPage
Object::create('SilverStripe\\Forms\\TextField', 'Text'),
Object::create('SilverStripe\\Forms\\HTMLEditor\\HTMLEditorField', 'HTMLField', 'HTMLField'),
Object::create('SilverStripe\\Forms\\EmailField', 'Email'),
Object::create('SilverStripe\\Forms\\PasswordField', 'Password'),
Object::create('SilverStripe\\Forms\\ConfirmedPasswordField', 'ConfirmedPassword')
// Object::create('SilverStripe\\Forms\\ConfirmedPasswordField', 'ConfirmedPassword')
));
$fields->addFieldsToTab('Root.Numeric', array(
@ -233,17 +234,20 @@ class BasicFieldsTestPage extends TestPage
));
// All these date/time fields generally have issues saving directly in the CMS
$minDate = date('Y-m-d', strtotime('-7 days'));
$fields->addFieldsToTab('Root.DateTime', array(
$calendarDateField = Object::create('SilverStripe\\Forms\\DateField', 'CalendarDate', 'DateField with calendar'),
Object::create('SilverStripe\\Forms\\DateField', 'Date', 'DateField'),
$dmyDateField = Object::create('SilverStripe\\Forms\\SeparatedDateField', 'DMYDate', 'DateField with separate fields'),
Object::create('SilverStripe\\Forms\\TimeField', 'Time', 'TimeField'),
Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTime', 'DateTime'),
$dateTimeShowCalendar = Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar')
Object::create('SilverStripe\\Forms\\DateField', 'CalendarDate', 'DateField with HTML5 (min date: ' . $minDate . ')')
->setMinDate($minDate),
Object::create('SilverStripe\\Forms\\DateField', 'Date', 'DateField without HTML5')
->setHTML5(false),
Object::create('SilverStripe\\Forms\\TimeField', 'Time', 'TimeField without HTML5')
->setHTML5(false),
Object::create('SilverStripe\\Forms\\TimeField', 'TimeHTML5', 'TimeField with HTML5'),
$dateTime = Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTime', 'DateTime without HTML5'),
$dateTimeShowCalendar = Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTimeWithCalendar', 'DateTime with HTML5')
));
$calendarDateField->setShowCalendar(true);
$dateTimeShowCalendar->getDateField()->setShowCalendar(true);
// $dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
$dateTime->getDateField()->setHTML5(true);
$dateTime->getTimeField()->setHTML5(true);
$dateTimeShowCalendar->setRightTitle('Right title');
$fields->addFieldsToTab('Root.File', array(