From d3af060ea9bb565235c5ebbc3e1485b4074637de Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Thu, 7 May 2020 12:26:33 +0000 Subject: [PATCH] [FIX] website: fix lightbox slideshow in gallery snippet Before this commit there was a traceback when rendering the lightbox in the gallery snippet. This bug was introduced by the new media dialog system. Related to task-2162952 closes odoo/odoo#51603 X-original-commit: 791ecf72af4a0928a02bf1bbdc269c67fcc3524c Signed-off-by: Quentin Smetz (qsm) --- .../website/static/src/snippets/s_image_gallery/000.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/addons/website/static/src/snippets/s_image_gallery/000.js b/addons/website/static/src/snippets/s_image_gallery/000.js index 72a9f2a0fe1..3bd6c10f389 100644 --- a/addons/website/static/src/snippets/s_image_gallery/000.js +++ b/addons/website/static/src/snippets/s_image_gallery/000.js @@ -28,8 +28,6 @@ const GalleryWidget = publicWidget.Widget.extend({ var self = this; var $cur = $(ev.currentTarget); - var urls = []; - var idx = undefined; var milliseconds = undefined; var params = undefined; var $images = $cur.closest('.o_gallery').find('img'); @@ -43,16 +41,12 @@ const GalleryWidget = publicWidget.Widget.extend({ height: Math.round(window.innerHeight * size) }; - $images.each(function () { - urls.push($(this).attr('src')); - }); var $img = ($cur.is('img') === true) ? $cur : $cur.closest('img'); - idx = urls.indexOf($img.attr('src')); milliseconds = $cur.closest('.o_gallery').data('interval') || false; var $modal = $(qweb.render('website.gallery.slideshow.lightbox', { - srcs: urls, - index: idx, + images: $images.get(), + index: $images.index($img), dim: dimensions, interval: milliseconds || 0, id: _.uniqueId('slideshow_'),