[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) <qsm@odoo.com>
This commit is contained in:
@@ -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_'),
|
||||
|
||||
Reference in New Issue
Block a user