From a545eb39195976a1a89d69e21bd5cfd39dae9b72 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 2 Nov 2016 15:35:01 +0100 Subject: [PATCH] [FIX] website: update gallery snippet thumbnails once an image is changed --- .../website/static/src/js/website.snippets.gallery.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js index 74f20e7a314..3b5d2ab66e4 100644 --- a/addons/website/static/src/js/website.snippets.gallery.js +++ b/addons/website/static/src/js/website.snippets.gallery.js @@ -367,7 +367,16 @@ options.registry.gallery_img = options.Class.extend({ var gallery = $parent.data('snippet-editor').styles.gallery; gallery.reapply(); }, 0); - } + }, + on_focus: function () { + this._super.apply(this, arguments); + if (this._current_src && this._current_src !== this.$target.attr("src")) { + _.defer((function () { + snippet_editor.globalSelector.closest(this.$target.parent()).data('snippet-editor').styles.gallery.reapply(); + }).bind(this)); + } + this._current_src = this.$target.attr("src"); + }, });