-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [#4650] Add variable select input to email registration
Either the `to_emails` or the `to_email_from_variable` fields should used when registering the email backend plugin. When a variable is selected, the resulting email address will be used for mailings. When the variable doesn't contain an email address, the `to_emails` will be used as fallback.
- Loading branch information
1 parent
b0b5055
commit ea59fa3
Showing
5 changed files
with
136 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...js/components/admin/form_design/registrations/email/fields/EmailRecipientsFromVariable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import {useField} from 'formik'; | ||
import React from 'react'; | ||
import {FormattedMessage} from 'react-intl'; | ||
|
||
import Field from 'components/admin/forms/Field'; | ||
import FormRow from 'components/admin/forms/FormRow'; | ||
import VariableSelection from 'components/admin/forms/VariableSelection'; | ||
|
||
const EmailRecipientsFromVariable = () => { | ||
const [fieldProps, , fieldHelpers] = useField('toEmailsFromVariable'); | ||
const {setValue} = fieldHelpers; | ||
return ( | ||
<FormRow> | ||
<Field | ||
name="toEmailsFromVariable" | ||
label={ | ||
<FormattedMessage | ||
description="Email registration options 'toEmailsFromVariable' label" | ||
defaultMessage="Using a variable to decide to which email address the | ||
submission details will be sent" | ||
/> | ||
} | ||
helpText={ | ||
<FormattedMessage | ||
description="Email registration options 'toEmailsFromVariable' helpText" | ||
defaultMessage="The email address described in this variable will be used | ||
for the mailing. If a variable is selected, the general registration | ||
addresses will be used as fallback option. " | ||
/> | ||
} | ||
> | ||
<VariableSelection | ||
name="toEmailsFromVariable" | ||
value={fieldProps.value} | ||
onChange={event => { | ||
setValue(event.target.value); | ||
}} | ||
/> | ||
</Field> | ||
</FormRow> | ||
); | ||
}; | ||
|
||
EmailRecipientsFromVariable.propTypes = {}; | ||
|
||
export default EmailRecipientsFromVariable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters