FIX Fix CMS css name, remove old showcalendar DateField config, update CountryDropdownField

This commit is contained in:
Robbie Averill 2017-08-14 10:06:17 +12:00
parent 0907398c31
commit eea60f66f1
8 changed files with 13 additions and 14 deletions

View File

@ -91,9 +91,7 @@ class UserFormsGridFieldFilterHeader extends GridFieldFilterHeader
)));
foreach (array($start, $end) as $date) {
$date->setConfig('showcalendar', true);
$date->setConfig('dateformat', 'y-mm-dd');
$date->setConfig('datavalueformat', 'y-mm-dd');
$date->setDateFormat('y-mm-dd');
$date->addExtraClass('no-change-track');
}
@ -121,7 +119,7 @@ class UserFormsGridFieldFilterHeader extends GridFieldFilterHeader
return array(
'header' => $forTemplate->renderWith('GridFieldFilterHeader_Row')
'header' => $forTemplate->renderWith(GridFieldFilterHeader::class . '_Row')
);
}

View File

@ -11,7 +11,6 @@ use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
*/
abstract class UserFormsCompositeField extends CompositeField implements UserFormsFieldContainer
{
/**
* Parent field
*
@ -38,10 +37,11 @@ abstract class UserFormsCompositeField extends CompositeField implements UserFor
}
// Skip over fields that don't generate formfields
$formField = $field->getFormField();
if (!$formField) {
if (get_class($field) === EditableFormField::class || !$field->getFormField()) {
return $this;
}
/** @var EditableFormField $formField */
$formField = $field->getFormField();
// Save this field
$this->push($formField);

View File

@ -3,7 +3,8 @@
namespace SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\Core\Manifest\ModuleLoader;
use CountryDropdownField; // @todo
use SilverStripe\Forms\DropdownField;
use SilverStripe\i18n\i18n;
use SilverStripe\UserForms\Model\EditableCustomRule;
use SilverStripe\UserForms\Model\EditableFormField;
@ -34,7 +35,8 @@ class EditableCountryDropdownField extends EditableFormField
public function getFormField()
{
$field = CountryDropdownField::create($this->Name, $this->EscapedTitle)
$field = DropdownField::create($this->Name, $this->EscapedTitle)
->setSource(i18n::getData()->getCountries())
->setFieldHolderTemplate('UserFormsField_holder')
->setTemplate('UserFormsDropdownField');

View File

@ -59,7 +59,6 @@ class EditableDateField extends EditableFormField
: $this->Default;
$field = FormField::create($this->Name, $this->EscapedTitle, $defaultValue)
->setConfig('showcalendar', true)
->setFieldHolderTemplate('UserFormsField_holder')
->setTemplate('UserFormsField');

View File

@ -11,6 +11,6 @@ class FormField extends DateField
{
public function Type()
{
return "date-alt text";
return 'date-alt text';
}
}

View File

@ -68,7 +68,7 @@ class EditableFormHeading extends EditableFormField
public function getFormField()
{
$labelField = HeaderField::create($this->EscapedTitle)
$labelField = HeaderField::create('userforms-header', $this->EscapedTitle)
->setHeadingLevel($this->Level);
$labelField->addExtraClass('FormHeading');
$labelField->setAttribute('data-id', $this->Name);

View File

@ -173,7 +173,7 @@ class UserDefinedForm extends Page
public function getCMSFields()
{
Requirements::css(
ModuleLoader::getModule('silverstripe/userforms')->getRelativeResourcePath('css/UserForms_cms.css')
ModuleLoader::getModule('silverstripe/userforms')->getRelativeResourcePath('css/UserForm_cms.css')
);
$this->beforeUpdateCMSFields(function ($fields) {

View File

@ -22,7 +22,7 @@ $ gem install compass
## Compile assets
Make your changes to `scss/UserForms.scss` or `scss/UserForms_cms.scss`. Then navigate to the `userforms` folder and run:
Make your changes to `scss/UserForm.scss` or `scss/UserForm_cms.scss`. Then navigate to the `userforms` folder and run:
```sh
$ compass compile