diff --git a/etemplate/js/et2_widget_vfs.js b/etemplate/js/et2_widget_vfs.js index 7675079b18..38145945e1 100644 --- a/etemplate/js/et2_widget_vfs.js +++ b/etemplate/js/et2_widget_vfs.js @@ -259,7 +259,7 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM], "description": "Size of icon / thumbnail, in pixels", "default": et2_no_init }, - expose_callback:{ + "expose_callback":{ "name": "expose_callback", "type": "js", "default": et2_no_init, @@ -279,7 +279,13 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM], this.iconOverlayContainer = jQuery(document.createElement('span')).addClass('iconOverlayContainer'); this.image = jQuery(document.createElement("img")); this.image.addClass("et2_vfs vfsMimeIcon"); - var self= this; + this.iconOverlayContainer.append(this.image); + this.setDOMNode(this.iconOverlayContainer[0]); + }, + + set_expose_callback: function(_callback) + { + var self=this; if (this.options.expose_callback) { jQuery(this.expose_options.container).on ('slide', function (event) { @@ -291,10 +297,7 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM], } }); } - this.iconOverlayContainer.append(this.image); - this.setDOMNode(this.iconOverlayContainer[0]); }, - /** * Function to get media content to feed the expose * @param {type} _value diff --git a/etemplate/js/expose.js b/etemplate/js/expose.js index 02f5f19e3b..9eac67e08a 100644 --- a/etemplate/js/expose.js +++ b/etemplate/js/expose.js @@ -32,7 +32,7 @@ function expose (widget) */ init: function() { this._super.apply(this, arguments); - expose.options = { + this.expose_options = { // The Id, element or querySelector of the gallery widget: container: '#blueimp-gallery', // The tag name, Id, element or querySelector of the slides container: @@ -180,14 +180,21 @@ function expose (widget) $body.append($expose_node); } - jQuery(this.node).on('click', function (){ - self._init_blueimp_gallery(); + }, + + set_value:function (_value) + { + this._super.apply(this,arguments) + var self=this; + this.image.on('click', function(){ + self._init_blueimp_gallery(_value); }); }, - _init_blueimp_gallery: function () + + _init_blueimp_gallery: function (_value) { - var mediaContent = this.getMedia(); - blueimp.Gallery(mediaContent, expose.options); + var mediaContent = this.getMedia(_value); + blueimp.Gallery(mediaContent, this.expose_options); }, expose_event:function (event){ console.log(event);