mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX Fix CMS css name, remove old showcalendar DateField config, update CountryDropdownField
This commit is contained in:
parent
0907398c31
commit
eea60f66f1
@ -91,9 +91,7 @@ class UserFormsGridFieldFilterHeader extends GridFieldFilterHeader
|
|||||||
)));
|
)));
|
||||||
|
|
||||||
foreach (array($start, $end) as $date) {
|
foreach (array($start, $end) as $date) {
|
||||||
$date->setConfig('showcalendar', true);
|
$date->setDateFormat('y-mm-dd');
|
||||||
$date->setConfig('dateformat', 'y-mm-dd');
|
|
||||||
$date->setConfig('datavalueformat', 'y-mm-dd');
|
|
||||||
$date->addExtraClass('no-change-track');
|
$date->addExtraClass('no-change-track');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +119,7 @@ class UserFormsGridFieldFilterHeader extends GridFieldFilterHeader
|
|||||||
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'header' => $forTemplate->renderWith('GridFieldFilterHeader_Row')
|
'header' => $forTemplate->renderWith(GridFieldFilterHeader::class . '_Row')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
|||||||
*/
|
*/
|
||||||
abstract class UserFormsCompositeField extends CompositeField implements UserFormsFieldContainer
|
abstract class UserFormsCompositeField extends CompositeField implements UserFormsFieldContainer
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent field
|
* Parent field
|
||||||
*
|
*
|
||||||
@ -38,10 +37,11 @@ abstract class UserFormsCompositeField extends CompositeField implements UserFor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip over fields that don't generate formfields
|
// Skip over fields that don't generate formfields
|
||||||
$formField = $field->getFormField();
|
if (get_class($field) === EditableFormField::class || !$field->getFormField()) {
|
||||||
if (!$formField) {
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
/** @var EditableFormField $formField */
|
||||||
|
$formField = $field->getFormField();
|
||||||
|
|
||||||
// Save this field
|
// Save this field
|
||||||
$this->push($formField);
|
$this->push($formField);
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
namespace SilverStripe\UserForms\Model\EditableFormField;
|
namespace SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
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\EditableCustomRule;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
@ -34,7 +35,8 @@ class EditableCountryDropdownField extends EditableFormField
|
|||||||
|
|
||||||
public function getFormField()
|
public function getFormField()
|
||||||
{
|
{
|
||||||
$field = CountryDropdownField::create($this->Name, $this->EscapedTitle)
|
$field = DropdownField::create($this->Name, $this->EscapedTitle)
|
||||||
|
->setSource(i18n::getData()->getCountries())
|
||||||
->setFieldHolderTemplate('UserFormsField_holder')
|
->setFieldHolderTemplate('UserFormsField_holder')
|
||||||
->setTemplate('UserFormsDropdownField');
|
->setTemplate('UserFormsDropdownField');
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ class EditableDateField extends EditableFormField
|
|||||||
: $this->Default;
|
: $this->Default;
|
||||||
|
|
||||||
$field = FormField::create($this->Name, $this->EscapedTitle, $defaultValue)
|
$field = FormField::create($this->Name, $this->EscapedTitle, $defaultValue)
|
||||||
->setConfig('showcalendar', true)
|
|
||||||
->setFieldHolderTemplate('UserFormsField_holder')
|
->setFieldHolderTemplate('UserFormsField_holder')
|
||||||
->setTemplate('UserFormsField');
|
->setTemplate('UserFormsField');
|
||||||
|
|
||||||
|
@ -11,6 +11,6 @@ class FormField extends DateField
|
|||||||
{
|
{
|
||||||
public function Type()
|
public function Type()
|
||||||
{
|
{
|
||||||
return "date-alt text";
|
return 'date-alt text';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class EditableFormHeading extends EditableFormField
|
|||||||
|
|
||||||
public function getFormField()
|
public function getFormField()
|
||||||
{
|
{
|
||||||
$labelField = HeaderField::create($this->EscapedTitle)
|
$labelField = HeaderField::create('userforms-header', $this->EscapedTitle)
|
||||||
->setHeadingLevel($this->Level);
|
->setHeadingLevel($this->Level);
|
||||||
$labelField->addExtraClass('FormHeading');
|
$labelField->addExtraClass('FormHeading');
|
||||||
$labelField->setAttribute('data-id', $this->Name);
|
$labelField->setAttribute('data-id', $this->Name);
|
||||||
|
@ -173,7 +173,7 @@ class UserDefinedForm extends Page
|
|||||||
public function getCMSFields()
|
public function getCMSFields()
|
||||||
{
|
{
|
||||||
Requirements::css(
|
Requirements::css(
|
||||||
ModuleLoader::getModule('silverstripe/userforms')->getRelativeResourcePath('css/UserForms_cms.css')
|
ModuleLoader::getModule('silverstripe/userforms')->getRelativeResourcePath('css/UserForm_cms.css')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->beforeUpdateCMSFields(function ($fields) {
|
$this->beforeUpdateCMSFields(function ($fields) {
|
||||||
|
@ -22,7 +22,7 @@ $ gem install compass
|
|||||||
|
|
||||||
## Compile assets
|
## 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
|
```sh
|
||||||
$ compass compile
|
$ compass compile
|
||||||
|
Loading…
Reference in New Issue
Block a user