plone / plone.patternslib

An add-on to make patternslib patterns available within Plone 5.
https://pypi.org/project/plone.patternslib/
GNU General Public License v2.0
2 stars 5 forks source link

Status of pat-gallery #27

Closed ezvirtual closed 6 years ago

ezvirtual commented 6 years ago

Hi there, I was hoping that someone could shed some insight into the status of the patternslib gallery:

Thanks in advance for any assistance you can provide.

thet commented 6 years ago

I use it. It's based on http://photoswipe.com/

You have to install plone.patternslib to install the resource definitions. Then include the pattern JS + LESS in your bundle:

your custom bundle JS:

require([
  'jquery',
  'pat-registry',
  'pat-gallery'
], function($, registry) {
    if (window.parent === window) {
        $(document).ready(function() {
            if (!registry.initialized) {
                registry.init();
            }
        });
    }
});

And in your custom bundle LESS:

@import (less) "@{photoswipe-ui}";
@import (less) "@{photoswipe}";

Unfortunately, the plone.patternslib bundle doesn't provide the gallery integration. If it would, the steps above would be obsolete.

And use it in your template:

<div class="pat-gallery">
  <figure tal:repeat="item view/results">
    <a href="${item/url}">
      <img tal:replace="structure item/imagetag" />
    </a>
  </figure>
</div>

That's it, basically.

Also see: https://github.com/Patternslib/Patterns/blob/master/src/pat/gallery/documentation.md

ezvirtual commented 6 years ago

Nice one, thank you very much for that assistance :)