volto icon indicating copy to clipboard operation
volto copied to clipboard

Make teaser block dynamic

Open pbauer opened this issue 1 year ago • 0 comments

PLIP (Plone Improvement Proposal)

Responsible Persons

Proposer: Philip Bauer @pbauer

Seconder:

Abstract

Separated from #4208 Make teasers show dynamic data by default. Optionally users can choose to overwrite the data (old behavior)

Motivation

A teaser block currently does not change when the target-object is changed. This is breaking the expectations of most users.

Assumptions

Proposal & Implementation

All teasers are by default dynamic. The teaser block gets a checkbox that allows to override a teaser. Checking it shows the teasers-fields that are read from the target. The override-feature can be disabled globally in the volto registry.

A serializer in plone-restapi for the teaser block gets the data of the target to display if the block is not set to overwrite. So no additional requests are necessary to get the dynamic data on a lite with many teasers.

Extending the data is possible by adding a adapter for IJSONSummarySerializerMetadata. We could also try to configure that in the frontend by storing what is now selectedItemAttrs in the data of each teaser and using that in the serializer to add additional metadata.

Migration: We should prevent existing teaser to change only if you update Plone (volto and restapi). With the implementation in https://github.com/plone/plone.restapi/pull/1788/commits/fb62f808220beed2a7461f1d61d688a9a3e2d11c a teaser that was added before the overwrite-bool was added to the schema will be overwritten until the editor changes that.

The implementation is built based on #4790 by @steffenri, @nileshgulia1, @claudiaifrim and @pbauer and the block-serializer of @davisagli

Deliverables

  • [ ] TeaserBlockSerializerBase in plone.restapi: https://github.com/plone/plone.restapi/pull/1788
  • [ ] Update teaser: https://github.com/plone/volto/pull/6024
  • [ ] Update documentation

Risks

The change in plone.restapi must not have any effect if used with a older version of Volto. That is already the case. The change in Volto only works when used together with the updated version of restapi. I guess that is acceptable.

Participants

@pbauer @pnicolli

pbauer avatar May 16 '24 17:05 pbauer