-
-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slots in Volto #1430
Comments
I like "Slots". I think portlets are a different story and, for their use case, they're unavoidable. They have database storage, can be configured TTW and they have inheritance. Whatever system would be created to replace them would just reimplement portlet storage and definitions. Let's take a simple use case: the website editor wants to add a static text notification in a section of a website. Right now, in classic Plone, all he has to do is create a new Static Text portlet and it will be inherited in that section (subfolders, etc). There's no way to have this in Volto right now. The implementation I had in mind for the so-called "viewlets" was that they would allow a centralized place to register
And then, in the appropriate places, a component would be inserted like:
An addon would add a new slot insertion such as:
|
@nzambello I implemented However, I would like to discuss this in depth because I still see some use cases, where a simple solution might be ok. Let's schedule a meeting to talk about this! Regarding portlets I like to see them more like Viewlets that can be configured and the config stored. When one say Viewlets, one can say blocks :) I fiddled around with the concept, and works pretty well, I even created a |
I've mentioned it because it's the only viewlet that I can name by heart, and even then I don't think I got the name right. Let's take a simple use case: I have a behavior called IExtendedMetadata whatever. It has several tagging and metadata fields that are used for to group and semantically decorate content. I can enable this behavior on several content types, including some that are block-powered. Next, I want a box with this metadata to appear on all pages that have these fields. Sure, I can shadow |
@tiberiuichim I like the idea and the implementation! Implementations change over time, but good ideas/concepts don’t. So I’m +1 to bring the slots conceptualization in the same way of Plone Viewlets. |
There's also old #16 which suggests looking at react-fill-slots. I've looked at it, it's an old library by now and I think outdated by today's standards. I also don't think there's a need for it if we use the system described above. |
Had a rethought about it and a conversation with @tiberiuichim I'll try to summarize what we spoke about:
I see slots more than an evolution of the portlet paradigm, but a merge between Viewlets Managers and Portlets Managers, all at once. The slots could not only contain user parameterizable (persistent config and data) components (mainly blocks) but also static context aware components (aka viewlets) assigned to a place (slot) in the layout. Inheritance/block/per content type/group are still valid and valuable use cases. The ability to pre-define the slots per content type (like the new Volto blocks layout per content type feature) is also a nice to have. Some portlet use case are still capital i.e. navigation portlet. The portlet engine can still be the foundation of the slots, even in the most simple form (create a portlet that can hold JSON to store the slot blocks. Example: Doormat Example: Typical aside portlets slots (add more examples here) To improve and avoid the shadowing hell we could also make the most of the basic Volto "Viwelets" to have a viewlet manager where you can add or remove components: Example: App.jsx |
Further discussions:
|
I would like to be able to add "Slots" only to specific Views which are bound to specific Content Types. I think it would be quite nice if I could do something like the following in a <div id="page-document" className="ui container viewwrapper eduproduct-view">
<div class="ui two grid">
<div class="column left" style={{ flex: '1' }}>
<RenderBlocks content={content} slotKey="mainContent" />
</div>
<div class="column right" style={{ flex: '0 0 100px' }}>
<RenderBlocks content={content} slotKey="sidebar" />
</div>
</div>
</div> In this example, in the Editing-UI, the content editors could use two "lanes" of blocks instead of only one. What do you think about this? Probably it would also be nice to restrict the use of block-types for different "slot-keys". If this is already somehow possible with Volto and I just missed it, please advice :-) Thank you :) |
Done in #5775 |
We need to increase the "insertion points" in Volto by using something close to Plone Viewlets/Portlets/Macros. I would run from these names, and go for something more generic and not Plone-ish, to avoid confusion. I suggest to use "slots".
Macros-ish:
#1424
Viewlet-ish:
https://github.com/eea/volto-addons/tree/master/src/Viewlets
Portlet-ish?
We need to find time to discuss this.
The text was updated successfully, but these errors were encountered: