[IMP] website: remove right/left indicators in gallery in editor

In gallery snippet with slideshow mode, the right/left indicators have
now the same behavior in editor and outside. Before this commit, these
indicators were always visible in editable mode.

Part of https://github.com/odoo/odoo/pull/45096
task-2162952
This commit is contained in:
Benjamin Vray
2020-07-17 11:28:11 +00:00
committed by qsm-odoo
parent 119637cf9e
commit 7a36eee043
@@ -99,9 +99,6 @@ const GallerySliderWidget = publicWidget.Widget.extend({
$lis.each(function (i) {
$(this).toggleClass('d-none', i < page * nbPerPage || i >= (page + 1) * nbPerPage);
});
if (self.editableMode) { // do not remove DOM in edit mode
return;
}
if (page <= 0) {
self.$prev.detach();
} else {
@@ -133,7 +130,11 @@ const GallerySliderWidget = publicWidget.Widget.extend({
page += ($(this).hasClass('o_indicators_left') ? -1 : 1);
page = Math.max(0, Math.min(nbPages - 1, page)); // should not be necessary
self.$carousel.carousel(page * realNbPerPage);
hide();
// We dont use hide() before the slide animation in the editor because there is a traceback
// TO DO: fix this traceback
if (!self.editableMode) {
hide();
}
});
this.$carousel.on('slid.bs.carousel.gallery_slider', update);