plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Layout based serialization, include default_page in serialization

Open tiberiuichim opened this issue 5 years ago • 4 comments

This PR makes it possible to use a different content serializer, based on the layout property of context (the default view, selected from the Display menu). I don't have a use case right now, but I think it would make sense to have it.

For example: suppose I have a component that serves as a layout view. Something like, I don't know, "database search results". This is not a block-based page, it's a traditional content type. If I'm able to switch between layout views for it, each of those Volto layout components could then potentially need different serialization data from the backend.

There's another feature in this PR: It includes, in the serialization of folders, a new property called "default_page" which serializes the linked default_page content, where it exists. In theory, with the exception of the Plone site (right now in Plone 5.2, where the Plone site is not a content item), there's no other place where "default pages" make sense. Volto block-based pages have a lot freedom in them on how they're composed.

Note: I'm asking for feedback. The PR is not finished, there's tests missing, etc.

tiberiuichim avatar May 12 '20 07:05 tiberiuichim

@tiberiuichim thanks for creating this Pull Request and help improve Plone!

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass.

Whenever you feel that the pull request is ready to be tested, either start all jenkins jobs pull requests by yourself, or simply add a comment in this pull request stating:

@jenkins-plone-org please run jobs

With this simple comment all the jobs will be started automatically.

Happy hacking!

mister-roboto avatar May 12 '20 07:05 mister-roboto

@jenkins-plone-org please run jobs

tiberiuichim avatar May 12 '20 07:05 tiberiuichim

@tisto Is the idea good for you? If so, I can make the requested changes and implement the tests.

wesleybl avatar Dec 14 '20 20:12 wesleybl

Coverage Status

Coverage decreased (-0.02%) to 94.46% when pulling e57d2c4a2db9fcc13f34b2c3bb19a81296e1604a on default_page into 4a3ad2bc1db7ee2084a18eeabe9272a8239c38c0 on master.

coveralls avatar Dec 15 '20 01:12 coveralls