In Plone 5.2.1, I'd like to have the AutoTOC for our site generate a collapsible list with interactive open/close buttons. In searching add-ons at PyPl, I didn't find anything.
However, it seems like this should be possible, but there are numerous sources turned up by web searches that broadly conflict as to how to do this and what the "way going forward" is. The first thing I found, now out of date, was here:
Which talks about patterns in Plone. Some searching led to this Patternslib resource:
...which conveniently tells you which patterns you DON'T get by including it in your build, but not which patterns you DO get (seemingly assuming you know this already?). I found an index of Patternslib patterns, which included this promising entry:
https://patternslib.com/expandable-tree
...which is very confidence-boosting in that the "demo" doesn't function at all. But still, I guess it's good to know that it exists?
However, various comments on the GitHub page above, references to the post at the top of this, and community forum posts led me to believe that Patternslib was the "old" way of doing things and that I should be looking at Mockup instead. That led me to this site:
http://plone.github.io/mockup/dev/#pattern/tree
The documentation for which has a nice "node1" and "node2" example that you can click to expose and retract sub-elements. However, pasting the supplied code for that example:
<div class="pat-tree"
data-pat-tree='data:[
{ "label": "node1",
"children": [
{ "label": "child1" },
{ "label": "child2" }
]
},
{ "label": "node2",
"children": [
{ "label": "child3" }
]
}
];'> </div>
...into a Page in the Plone 5.2.1 site in question does not do anything at all. (The page remains completely blank.)
My questions are:
- Is there something pre-existing that can do this which I utterly failed to find?
- If I have to roll my own, is it right that Mockup is the way to go now?
- Do I have to do something to enable using Mockup patterns first?
- Can I test Mockup patterns by just sticking them into the "View Code" panel on a page in TinyMCE (with filtering completely disabled), or is this only accessible through coding add-ons, etc.?
- If I can make a test that works, would it be possible to modify the AutoTOC behaviour to leverage this Mockup pattern simply by editing the CSS for it, or is that a dead end (because it's not flexible enough, or... etc.)?