Merge pull request #31 from open-sausages/pulls/4.0/i18n-locale

Adapt to 4.x date/numeric field changes
This commit is contained in:
Damian Mooyman 2017-02-16 11:30:51 +13:00 committed by GitHub
commit 6c03a99621

View File

@ -47,7 +47,7 @@ class BasicFieldsTestPage extends TestPage
'MyLabelledFieldGroup2' => 'Varchar', 'MyLabelledFieldGroup2' => 'Varchar',
'MyLabelledFieldGroup3' => 'Int', 'MyLabelledFieldGroup3' => 'Int',
'MyLabelledFieldGroupCheckbox' => 'Boolean', 'MyLabelledFieldGroupCheckbox' => 'Boolean',
'Number' => 'Int', 'Number' => 'Float',
'OptionSet' => 'Varchar', 'OptionSet' => 'Varchar',
'Password' => 'Varchar', 'Password' => 'Varchar',
'PhoneNumber' => 'Varchar', 'PhoneNumber' => 'Varchar',
@ -144,7 +144,7 @@ class BasicFieldsTestPage extends TestPage
'MyLabelledFieldGroup2' => 'My value (ä!)', 'MyLabelledFieldGroup2' => 'My value (ä!)',
'MyLabelledFieldGroup3' => 2, 'MyLabelledFieldGroup3' => 2,
'MyLabelledFieldGroupCheckbox' => true, 'MyLabelledFieldGroupCheckbox' => true,
'Number' => 99, 'Number' => 99.123,
'OptionSet' => $thirdCat->ID, 'OptionSet' => $thirdCat->ID,
'Password' => 'My value (ä!)', 'Password' => 'My value (ä!)',
'PhoneNumber' => '021 1235', 'PhoneNumber' => '021 1235',
@ -197,7 +197,8 @@ class BasicFieldsTestPage extends TestPage
)); ));
$fields->addFieldsToTab('Root.Numeric', array( $fields->addFieldsToTab('Root.Numeric', array(
Object::create('SilverStripe\\Forms\\NumericField', 'Number'), Object::create('SilverStripe\\Forms\\NumericField', 'Number')
->setScale(4),
Object::create('SilverStripe\\Forms\\CurrencyField', 'Price'), Object::create('SilverStripe\\Forms\\CurrencyField', 'Price'),
Object::create('SilverStripe\\Forms\\MoneyField', 'Money', 'Money', array('Amount' => 99.99, 'Currency' => 'EUR')), Object::create('SilverStripe\\Forms\\MoneyField', 'Money', 'Money', array('Amount' => 99.99, 'Currency' => 'EUR')),
Object::create('SilverStripe\\Forms\\PhoneNumberField', 'PhoneNumber'), Object::create('SilverStripe\\Forms\\PhoneNumberField', 'PhoneNumber'),
@ -237,15 +238,14 @@ class BasicFieldsTestPage extends TestPage
$fields->addFieldsToTab('Root.DateTime', array( $fields->addFieldsToTab('Root.DateTime', array(
$calendarDateField = Object::create('SilverStripe\\Forms\\DateField', 'CalendarDate', 'DateField with calendar'), $calendarDateField = Object::create('SilverStripe\\Forms\\DateField', 'CalendarDate', 'DateField with calendar'),
Object::create('SilverStripe\\Forms\\DateField', 'Date', 'DateField'), Object::create('SilverStripe\\Forms\\DateField', 'Date', 'DateField'),
$dmyDateField = Object::create('SilverStripe\\Forms\\DateField', 'DMYDate', 'DateField with separate fields'), $dmyDateField = Object::create('SilverStripe\\Forms\\SeparatedDateField', 'DMYDate', 'DateField with separate fields'),
Object::create('SilverStripe\\Forms\\TimeField', 'Time', 'TimeField'), Object::create('SilverStripe\\Forms\\TimeField', 'Time', 'TimeField'),
Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTime', 'DateTime'), Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTime', 'DateTime'),
$dateTimeShowCalendar = Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar') $dateTimeShowCalendar = Object::create('SilverStripe\\Forms\\DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar')
)); ));
$calendarDateField->setConfig('showcalendar', true); $calendarDateField->setShowCalendar(true);
$dmyDateField->setConfig('dmyfields', true); $dateTimeShowCalendar->getDateField()->setShowCalendar(true);
$dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true); // $dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
$dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
$dateTimeShowCalendar->setRightTitle('Right title'); $dateTimeShowCalendar->setRightTitle('Right title');
$fields->addFieldsToTab('Root.File', array( $fields->addFieldsToTab('Root.File', array(