Mosaic is a layout solution for Plone which allows end users to create custom page layouts within a Plone website (video) using a simple drag and drop. There are ready made tiles for common situations, however I am starting to come across situations where the default tiles aren't what I want.
I decided it was time to explore the creation of custom tiles. I figured the best way to get going would be to look at how others have created custom tiles. I knew that custom tiles were used in the creation of the Plone 2016 conference website and that the source code for the site was published on github. I started by inspecting their code.
I setup Plone 5.0.7 with Mosaic 2.0rc5 and also the ploneconf2016 site profile (https://github.com/plone/ploneconf2016.policy). The code for the tile configuration is here: https://github.com/plone/ploneconf2016.policy/tree/master/ploneconf2016/policy/tiles
Once everything was installed I was able to create a fake conference website and add presentations, persons (speakers/presenters) and a few other content types.
The policy defines two custom tiles
- A slider tile
- A presentation tile
I was able to use both custom tiles without issue, the slider custom tile doesn't work out the box, meaning I could define the slides but the actual sliding didn't work. The slider depends on other components that are provided by the ploneconf2016 theme. It shouldn't be too hard to add the right CSS and JS to my own theme to get the slider working the way I want.
One note, when I cheated by not including a speaker on my presentation item, things "broke". To be fair this is to be expected since the presentation content type does have a red dot indicating that speakers are required items on presentations.
I got this error on the console
```
...
Module zope.component._api, line 120, in queryMultiAdapter
Module zope.interface.registry, line 245, in queryMultiAdapter
Module zope.interface.adapter, line 541, in queryMultiAdapter
Module plone.jsonserializer.deserializer.converters, line 69, in from_unicode_converter
Module zope.schema._field, line 322, in fromUnicode
Module zope.schema._bootstrapfields, line 183, in validate
Module zope.schema._field, line 338, in _validate
ConstraintNotSatisfied: (u'350d0a34ffcb4fc4943efdcf4bdb9f03', 'content_uid')
```
A quick guess... the content_uid was probably referring to the missing speaker.
I consider this a great first experiment. I have all the pieces working and I know how the code was put together. My next steps are 1) customize one of the conference tiles 2) create and register a brand new tile of my own.
No comments:
Post a Comment