From 691554ea2899fa418b599765b03abdcd31c19ee6 Mon Sep 17 00:00:00 2001 From: ionlizarazu Date: Wed, 12 Oct 2022 23:47:51 +0200 Subject: [PATCH 1/3] fix schema enhancer --- src/advancedSchema.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/advancedSchema.js b/src/advancedSchema.js index 01bb8ec..9755f39 100644 --- a/src/advancedSchema.js +++ b/src/advancedSchema.js @@ -2,7 +2,7 @@ import messages from './messages'; export const advancedSchema = (props) => { const { intl, schema, formData } = props; - const imageWidth = ['right', 'left'].includes(formData.imageSide) + const imageWidth = ['right', 'left'].includes(formData?.imageSide) ? ['imageWidth'] : []; const headingChoices = [ @@ -10,24 +10,27 @@ export const advancedSchema = (props) => { ['h3', 'H3'], ['h4', 'H4'], ]; + let heading = + formData && formData['@type'] === 'listing' + ? [ + { + id: 'header', + title: intl.formatMessage(messages.headerConfiguration), + fields: ['header', 'headerUrl', 'headerTag'], + }, + ] + : []; + return { ...schema, fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['variation'], - }, - { - id: 'querystring', - title: intl.formatMessage(messages.querystring), - fields: ['querystring'], - }, - { - id: 'header', - title: intl.formatMessage(messages.headerConfiguration), - fields: ['header', 'headerUrl', 'headerTag'], - }, + ...(schema.fieldsets && + schema.fieldsets.length > 0 && + schema.fieldsets.filter((fieldset) => fieldset.id === 'default')), + ...(schema.fieldsets && + schema.fieldsets.length > 0 && + schema.fieldsets.filter((fieldset) => fieldset.id === 'searchquery')), + ...heading, { id: 'columns', title: intl.formatMessage(messages.columnsConfiguration), From 20ac5caef06e3d77cf82521457274100a4fda4c1 Mon Sep 17 00:00:00 2001 From: ionlizarazu Date: Thu, 13 Oct 2022 10:15:25 +0200 Subject: [PATCH 2/3] list the fieldsets to include from the old schema --- src/advancedSchema.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/advancedSchema.js b/src/advancedSchema.js index 9755f39..41b8f95 100644 --- a/src/advancedSchema.js +++ b/src/advancedSchema.js @@ -20,16 +20,16 @@ export const advancedSchema = (props) => { }, ] : []; + const include_fieldsets = ['default', 'searchquery', 'facets', 'controls']; return { ...schema, fieldsets: [ ...(schema.fieldsets && schema.fieldsets.length > 0 && - schema.fieldsets.filter((fieldset) => fieldset.id === 'default')), - ...(schema.fieldsets && - schema.fieldsets.length > 0 && - schema.fieldsets.filter((fieldset) => fieldset.id === 'searchquery')), + schema.fieldsets.filter((fieldset) => + include_fieldsets.includes(fieldset.id), + )), ...heading, { id: 'columns', From 606a4c70e06484a9893445f136d1dd6827b63c40 Mon Sep 17 00:00:00 2001 From: Ion Lizarazu Date: Fri, 16 Dec 2022 08:57:28 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4f7b0d..2e9dc12 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# volto-listingadvanced-variation +![alt tag name](https://img.shields.io/github/v/tag/codesyntax/volto-listingadvanced-variation) + +# volto-listingadvanced-variation Volto addon to add an additional variation to the default listing block with advanced features