Skip to content

Commit

Permalink
organize fieldsets better
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Aug 26, 2024
1 parent 40139a7 commit ca4632c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
48 changes: 31 additions & 17 deletions frontend/packages/volto-form-block/src/schemaFormBlock/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a>, new line <br />, bold <b> and italic <i> 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',
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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],
};
};

0 comments on commit ca4632c

Please sign in to comment.