Skip to content

Commit

Permalink
Cleanup in schema enhancers
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Nov 17, 2022
1 parent e871e9e commit 93d95ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/blocks/Listing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const applyConfig = (config) => {
if (config.settings.integratesBlockStyles)
config.settings.integratesBlockStyles.push('listing');

listing.schemaEnhancer = moveQueryToFieldset(listing.schemaEnhancer);
listing.schemaEnhancer = composeSchema(
moveQueryToFieldset,
listing.schemaEnhancer,
);

// The split of responsibilities is as follows:
// the Listing block variation takes care of the Layout responsibility (how
Expand Down Expand Up @@ -130,9 +133,8 @@ const applyConfig = (config) => {

export default applyConfig;

const moveQueryToFieldset = (schemaEnhancer) => (props) => {
const moveQueryToFieldset = ({ schema }) => {
// NOTE: this is a schema finalizer
const schema = schemaEnhancer ? schemaEnhancer(props) : props.schema;

// move querystring to its own fieldset;
schema.fieldsets[0].fields = schema.fieldsets[0].fields.filter(
Expand Down
8 changes: 1 addition & 7 deletions src/blocks/Teaser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { addStyling } from '@plone/volto/helpers';
import TeaserCardTemplate from './Card';
import { adjustTeaserSchema } from './schema';
import UniversalCard from '@eeacms/volto-listing-block/components/UniversalCard/UniversalCard';
import {
// setCardStylingSchema,
// setCardModelSchema,
setBasicStylingSchema,
} from '../Listing/schema';
import { setBasicStylingSchema } from '../Listing/schema';

export default (config) => {
if (config.blocks.blocksConfig.teaser) {
Expand All @@ -27,8 +23,6 @@ export default (config) => {
schemaEnhancer: composeSchema(
adjustTeaserSchema,
UniversalCard.schemaEnhancer,
// setCardModelSchema,
// setCardStylingSchema,
),
},
// ...(config.blocks.blocksConfig.teaser.variations || []),
Expand Down

0 comments on commit 93d95ce

Please sign in to comment.