Skip to content

Commit

Permalink
v2.0.0-beta.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kjmartens committed Feb 16, 2018
1 parent 47ed102 commit f466703
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Solspace Freeform Changelog

## 2.0.0-beta.9 - 2018-02-16
### Changed
- Updated Dynamic Recipients fields to allow multiple email addresses per option (separated by commas).

### Fixed
- Fixed a bug where radio fields would not display errors if left empty.
- Fixed a bug where the demo templates errored on submission views after Craft 3 RC 10 update.

## 2.0.0-beta.8 - 2018-02-14
### Fixed
- Fixed a bug where the CP Submissions list page broke after Craft 3 RC 10 update.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "solspace/craft3-freeform",
"description": "The most intuitive and powerful form builder for Craft.",
"version": "2.0.0-beta.8",
"version": "2.0.0-beta.9",
"type": "craft-plugin",
"minimum-stability": "dev",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/Library/Composer/Components/AbstractField.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ protected function validate(): array
if (empty($value)) {
$errors[] = $this->translate('This field is required');
}
} else if ('' === $value) {
} else if (null === $value || '' === $value) {
$errors[] = $this->translate('This field is required');
}
}
Expand Down
16 changes: 15 additions & 1 deletion src/Library/Composer/Components/Fields/DynamicRecipientField.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ class DynamicRecipientField extends SelectField implements RecipientInterface, O
/** @var bool */
protected $showAsRadio;

/**
* @return string
*/
public static function getFieldType(): string
{
return FieldInterface::TYPE_DYNAMIC_RECIPIENTS;
}

/**
* @return bool
*/
Expand Down Expand Up @@ -88,8 +96,14 @@ public function getRecipients(): array

if (null !== $value && array_key_exists($value, $options)) {
$option = $options[$value];
$emails = explode(',', $option->getValue());

$batch = [];
foreach ($emails as $email) {
$batch[] = trim($email);
}

return [$option->getLabel() => $option->getValue()];
return $batch;
}

return [];
Expand Down
2 changes: 1 addition & 1 deletion src/codepack/templates/bootstrap/submissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>{{ form.name }}</h3>
{% for submission in submissions %}
<tr>
<td>{{ submission.id }}</td>
<td style="color: {{ submission.status }}">{{ submission.status.name }}</td>
<td style="color: {{ submission.statusModel.color }}">{{ submission.statusModel.name }}</td>
<td>
<a href="{{ siteUrl }}demo/bootstrap/{{ form.handle }}/submissions/{{ submission.id }}">
{{ submission.title }}
Expand Down
2 changes: 1 addition & 1 deletion src/codepack/templates/bootstrap/view_submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h3>{{ form.name }} - {{ submission.title }}</h3>
<table class="table table-striped">
<tr>
<th style="width: 20%;">Status</th>
<td style="color: {{ submission.status }}">{{ submission.status.name }}</td>
<td style="color: {{ submission.statusModel.color }}">{{ submission.statusModel.name }}</td>
</tr>
{% for field in submission.fieldMetadata %}
<tr>
Expand Down

0 comments on commit f466703

Please sign in to comment.