Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] website: correctly update carousel thumbnails on image insertion
Steps to reproduce the bug: - Add an "Image Gallery" on the website. - Add a new image on the snippet. -> Problem: the thumbnail of the first image of the carousel has been replaced by the new added image. To solve the problem, the triggering of the `image_changed` event has been removed on extra image added. It was introduced by [1] to trigger the re-rendering of the thumbnail when adding a new image on the carousel but was actually useless. Indeed, the mechanism was the same as now; when a new image was added on the carousel, the `website.gallery.slideshow` that already handles the thumbnails was re-rendered. An important thing to note is that the system was also never intercepting this `image_changed` event as it was triggered on an element that was not in the DOM (as it was removed at the `_replaceContent()` call in the `slideshow()` method). However, since [2], the images rendered by the `website.gallery.slideshow` are replaced by the images (or the wrapped anchored images) returned by `_getImgHolderEls`. Therefore, `$newImageToSelect` is part of the DOM and the `image_changed` event is intercepted by the gallery option. As the active carousel item is always the first one of the carousel after a `website.gallery.slideshow` re-rendering, the system changed the thumbnail of the first item with the new added image. [1]: odoo@8599076 [2]: odoo@0fd2477 task-3736301 closes odoo#153409 Signed-off-by: Quentin Smetz (qsm) <[email protected]>
- Loading branch information