Added event to refresh thumbnail after new selection
authorThierry Florac <thierry.florac@onf.fr>
Thu, 20 Sep 2018 14:33:50 +0200
changeset 106 5409ce8b714a
parent 105 f2cf11a82a79
child 107 2294ca6f68ee
Added event to refresh thumbnail after new selection
src/pyams_media/zmi/video.py
--- a/src/pyams_media/zmi/video.py	Thu Sep 20 13:47:23 2018 +0200
+++ b/src/pyams_media/zmi/video.py	Thu Sep 20 14:33:50 2018 +0200
@@ -26,6 +26,7 @@
 from pyams_form.schema import CloseButton
 from pyams_media import _
 from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.event import get_json_image_refresh_event
 from pyams_skin.interfaces.viewlet import IContextActions
 from pyams_skin.layer import IPyAMSLayer
 from pyams_skin.viewlet.toolbar import ToolbarActionItem
@@ -141,9 +142,14 @@
     def get_ajax_output(self, changes):
         translate = self.request.localizer.translate
         if changes:
+            thumbnails = IThumbnails(self.context)
+            thumbnail = thumbnails.get_thumbnail('128x128')
             return {
                 'status': 'success',
-                'message': translate(_("Thumbnail selected successfully."))
+                'message': translate(_("Thumbnail selected successfully.")),
+                'events': [
+                    get_json_image_refresh_event(thumbnail, self.request)
+                ]
             }
         else:
             return {