I am trying to bring collective.interfaces up to date for Plone 5. The available marker interfaces listing was using collapsiblesections.js, but that's gone. So I made a lucky guess and found http://patternslib.com/collapsible/ . So given the listing template generates something like this:
<dl class="collapsible closed inline collapsedOnLoad">
<dt class="collapsibleHeader">Title of collapsible content</dt>
<dd class="collapsibleContent">Collapsible content text here</dd>
.. I thought I could just replace "collapsible" with "pat-collapsible" (as per the pattern docs). But that's not working... any suggestions?
I think the solution is to use the toggle pattern from mockup:
Check out the example in "Build a collapsable with toggle".
The solution is not to use the toggle pattern from mockup. It's name clashes with a Patternslib pattern which already exists. Additionally, we want to use core Patternslib patterns whenever possible, to reduce duplication of code and effort.
So if pat-collapsible works, then IMO that should be used.
There is a pull request being reviewed currently to expose all Patternslib patterns in Products.CMFPlone (they're not yet in the bundles or registry.xml however).
See here: https://github.com/plone/Products.CMFPlone/pull/1191 (comments on the ticket appreciated).
BTW, Maik Derstappen @MrTango is in the process of merging the Mockup toggle pattern into Patternslib.
Thanks @alert & @jcbrand. I saw that Plone can serve the mockup toggle pattern JS file on request, so just to get started somehow, I went and included it in the default profile's registry.xml as:
After importing the profile, the file loads but I get a JS error:
Error: Mismatched anonymous define() module: ...
so apparently just including the JS is not enough or plain wrong. So what exactly is needed to use a pattern from mockup (or patternslib)? I thought using mockup patterns must be documented somewhere, but all I could find was docs on how to build a pattern...? Any pointers would be appreaciated.
@petri the mockup toggle pattern should already be in the registry.xml, no?
In order to use the Patternslib pattern, it would mean also adding that pattern into the registry, which is why I want to add the Patternslib patterns to Products.CMFPlone's repo in the above mentioned pull request.
Ah thanks of course, I was confused... so I assume all the mockup patterns are already available in Plone 5?
If that's the case, I don't understand why using using "pat-toggle" CSS class as per mockup docs does not work... for example, using the simplest example from the mockup docs:
class="btn btn-default pat-toggle"
data-pat-toggle="value:btn-lg;">This button goes bigger/smaller!</button>