Example image gallery

This is a simple HTML page to give a very basic demonstration of how to setup gallery of images and make them editable using CushyCMS.

Caveat: this solution requires javascript, and uses repeatable regions in CushyCMS which are only part of the pro features

The basics for this particular implementation should hopefully be pretty easy to follow. Here are some things to note if you view the source of the above gallery.

  1. There are in fact 2 images in the source for each gallery item. One is the thumbnail, and the other is the main (bigger) image. Both these images have hardcoded width and height attributes. This is to utilize the image resizing feature of CushyCMS to make sure our editors don't upload images that will blow out the design. The downside here is that the editor will need to upload the same image twice. But the upside is that the resulting page is much nicer looking and better for viewers of the site.
  2. The source also contains a description that is also hidden in the same way the main image is hidden. This is because for CushyCMS to be able to edit the content, it has to exist somewhere. But we don't want it visible by default, only in the fancybox modal. In the javascript source there is some code that is moving the content of the editable description element into the title of the link for the modal to display.
  3. We're using a <h5> tag to edit the description. Whilst this doesn't make for great semantic HTML, we know that CushyCMS will correctly encode any HTML (such as & symbols) inside these tags, as well as give a nice tiny 1 line editable box on the edit screen. The edit box also won't have a toolbar with all the icons, which is ideal as we don't want the edit to be adding flash objects, links or any other fancy stuff to the description.
  4. This solution uses both jQuery and FancyBox as an alternative to other lightbox or modal solutions. I found this the easiest to use for my particular example here. Solutions that work work automatically without you adding any JS yourself won't work in this situation since we are using our own JS to alter the description etc and this needs to happen before the modal does what it needs to do.

Here is a screenshot of how this looks to your editor. We have only taken a sample of the edit boxes for one of the images above. This will of course be repeated for all 3 images. As you can see in the top right, there are control buttons for your editor to clone the entire editable group. This will clone the whole <li> element from the example code.