diff options
| author | qsm-odoo <qsm@odoo.com> | 2016-10-18 11:39:15 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2016-10-18 13:14:23 +0200 |
| commit | d5464458c53db8dcdb7147656916f82b95869956 (patch) | |
| tree | 139d0aa2f5e871fd05b4f6330dbcb0aecac35f61 /addons/website/static/src/js/website.snippets.editor.js | |
| parent | a40c3bf7922dc2a14ceb64621f11b34ec30ef213 (diff) | |
[FIX] website: properly unbind events of parallax snippet option
Recent refactoring of the parallax changed the snippet option JS and
attached a callback on a editor element but forgot to detach it if
the parallax snippet is removed. This added a bug which broke the
editor every time a parallax snippet was removed.
Diffstat (limited to 'addons/website/static/src/js/website.snippets.editor.js')
| -rw-r--r-- | addons/website/static/src/js/website.snippets.editor.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index cfd0b561778..4fbb79dd89e 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -311,8 +311,10 @@ options.registry.parallax = options.Class.extend({ this.$target.data("snippet-view", new animation.registry.parallax(this.$target)); } this.scroll(); - this.buildingBlock.$el.on("snippet-dropped snippet-activated", this._refresh.bind(this)); - this.$target.on('snippet-option-change snippet-option-preview', this._refresh.bind(this)); + + this._refresh_callback = this._refresh.bind(this); + this.buildingBlock.$el.on("snippet-dropped snippet-activated", this._refresh_callback); + this.$target.on('snippet-option-change snippet-option-preview', this._refresh_callback); }, scroll: function (type, value) { this.$target.attr("data-scroll-background-ratio", value); @@ -330,6 +332,11 @@ options.registry.parallax = options.Class.extend({ this._super.apply(this, arguments); this._refresh(); }, + on_remove: function () { + this._super.apply(this, arguments); + this.$target.off("snippet-option-change snippet-option-preview", this._refresh_callback); + this.buildingBlock.$el.off("snippet-dropped snippet-activated", this._refresh_callback); + }, }); options.registry.ul = options.Class.extend({ |
