src/pyams_default_theme/resources/js/pyams-default.js
changeset 330 143f661e27e2
parent 319 29ffc22ece57
child 333 02a2c1a4bb6e
--- a/src/pyams_default_theme/resources/js/pyams-default.js	Thu Jan 03 15:30:47 2019 +0100
+++ b/src/pyams_default_theme/resources/js/pyams-default.js	Thu Jan 03 17:54:44 2019 +0100
@@ -63,10 +63,28 @@
 	 */
 	$(document).on('click', '[data-toggle="lightbox"]', function (event) {
 		event.preventDefault();
-		$(this).ekkoLightbox({
-			wrapping: false,
-			alwaysShowClose: true
-		});
+		var source = $(this);
+		ams.ajax.check($.fn.ekkoLightbox,
+					   '/--static--/pyams_default_theme/js/ext/ekko-lightbox' + ams.devext + '.js',
+					   function() {
+							source.ekkoLightbox({
+								wrapping: false,
+								alwaysShowClose: true,
+								onContentLoaded: function() {
+									var element = this.element(),
+										description = element.data('description'),
+										modal = this.modal(),
+										container = $('.ekko-lightbox-container', modal);
+									if (description) {
+										$('<div></div>').addClass('description')
+														.text(description)
+														.appendTo(container);
+									} else {
+										$('.description', container).remove();
+									}
+								}
+							});
+					   });
 	});
 
 	/**