Skip to content
Snippets Groups Projects
Commit a221342c authored by Romain Derie's avatar Romain Derie Committed by qsm-odoo
Browse files

[FIX] website: remove the handler in the destroy


What is done in start should be undone in the destroy.

closes odoo/odoo#100420

X-original-commit: 6f5fc1a2
Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
parent 7fbb337e
Branches
Tags
No related merge requests found
......@@ -18,7 +18,7 @@ options.registry.gallery = options.Class.extend({
var self = this;
// Make sure image previews are updated if images are changed
this.$target.on('image_changed', 'img', function (ev) {
this.$target.on('image_changed.gallery', 'img', function (ev) {
var $img = $(ev.currentTarget);
var index = self.$target.find('.carousel-item.active').index();
self.$('.carousel:first li[data-target]:eq(' + index + ')')
......@@ -27,12 +27,12 @@ options.registry.gallery = options.Class.extend({
// When the snippet is empty, an edition button is the default content
// TODO find a nicer way to do that to have editor style
this.$target.on('click', '.o_add_images', function (e) {
this.$target.on('click.gallery', '.o_add_images', function (e) {
e.stopImmediatePropagation();
self.addImages(false);
});
this.$target.on('dropped', 'img', function (ev) {
this.$target.on('dropped.gallery', 'img', function (ev) {
self.mode(null, self.getMode());
if (!ev.target.height) {
$(ev.target).one('load', function () {
......@@ -74,6 +74,13 @@ options.registry.gallery = options.Class.extend({
this.$target.removeAttr('style');
}
},
/**
* @override
*/
destroy() {
this._super(...arguments);
this.$target.off('.gallery');
},
//--------------------------------------------------------------------------
// Options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment