From ca4632c9b4cf8e2af431c55a795a2be5b06ab5c9 Mon Sep 17 00:00:00 2001 From: David Glick Date: Mon, 26 Aug 2024 12:00:21 -0700 Subject: [PATCH] organize fieldsets better --- .../restapi/services/submit_form/post.py | 2 +- .../src/schemaFormBlock/schema.js | 48 ++++++++++++------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/backend/src/collective/volto/formsupport/restapi/services/submit_form/post.py b/backend/src/collective/volto/formsupport/restapi/services/submit_form/post.py index 069d8d8..e05b9a0 100644 --- a/backend/src/collective/volto/formsupport/restapi/services/submit_form/post.py +++ b/backend/src/collective/volto/formsupport/restapi/services/submit_form/post.py @@ -338,7 +338,7 @@ def get_acknowledgement_field_value(self): return data.get("value") def get_subject(self): - subject = self.block.get("default_subject", "${subject}") + subject = self.block.get("default_subject") or "${subject}" subject = self.substitute_variables(subject) return subject diff --git a/frontend/packages/volto-form-block/src/schemaFormBlock/schema.js b/frontend/packages/volto-form-block/src/schemaFormBlock/schema.js index 957f1e4..e5436df 100644 --- a/frontend/packages/volto-form-block/src/schemaFormBlock/schema.js +++ b/frontend/packages/volto-form-block/src/schemaFormBlock/schema.js @@ -77,9 +77,17 @@ const messages = defineMessages({ // eslint-disable-next-line no-template-curly-in-string 'You can add the value of a filled field in the form by inserting its ID between curly brackets preceded by $, example: ${field_id}; you can add also html elements such as links , new line
, bold and italic formatting.', }, - manage_data: { - id: 'form_manage_data', - defaultMessage: 'Manage data', + fieldset_confirmation: { + id: 'fieldset_confirmation', + defaultMessage: 'Confirmation', + }, + fieldset_savedata: { + id: 'fieldset_savedata', + defaultMessage: 'Store data', + }, + fieldset_email: { + id: 'fieldset_email', + defaultMessage: 'Send email', }, mail_header_label: { id: 'mail_header_label', @@ -123,21 +131,33 @@ export const schemaFormBlockSchema = ({ formData, intl }) => { fields: [ 'title', 'description', - 'default_to', - 'default_from', - 'default_subject', 'submit_label', 'show_cancel', ...(formData?.show_cancel ? ['cancel_label'] : []), + 'captcha', + ], + }, + { + id: 'confirmation', + title: intl.formatMessage(messages.fieldset_confirmation), + fields: ['send_message'], + }, + { + id: 'email', + title: intl.formatMessage(messages.fieldset_email), + fields: [ + 'send', + 'default_to', + 'default_from', + 'default_subject', 'mail_header', 'mail_footer', - 'captcha', ], }, { - id: 'manage_data', - title: intl.formatMessage(messages.manage_data), - fields: ['store', 'remove_data_after_days', 'send', 'send_message'], + id: 'savedata', + title: intl.formatMessage(messages.fieldset_savedata), + fields: ['store', 'remove_data_after_days'], }, ], properties: { @@ -219,12 +239,6 @@ export const schemaFormBlockSchema = ({ formData, intl }) => { description: intl.formatMessage(messages.send_message_helptext), }, }, - required: [ - 'default_to', - 'default_from', - 'default_subject', - 'captcha', - ...conditional_required, - ], + required: ['default_from', 'captcha', ...conditional_required], }; };