From 9049d953ca6561243bd265e68879142b69201698 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 14 Feb 2017 12:33:53 +0100 Subject: [PATCH] [FIX] website: restore company edition option Commit d1a8d54aca2e386d804162d1dcfe2c213ae339ec broke the feature without mercy. The mentioned commit introduces a nice improvement to allow the edition of the company logo directly from frontend. However it also breaks the option for non-logo parts (example: clicking on the address on the contact us page). It also leaves most of the option code behind, which makes useless code being executed for nothing. This commit restores the company option the way it was and simply deactivates it for the logo edition, which was the desired behavior. --- .../static/src/js/website.snippets.editor.js | 16 ++++++++++++++++ addons/website/views/snippets.xml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index 5ea11dc63c4..94bb408b9ac 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -70,6 +70,22 @@ options.registry.company_data = options.Class.extend({ }); } }, + + on_focus: function () { + this._super.apply(this, arguments); + + var proto = options.registry.company_data.prototype; + + Dialog.confirm(null, _t("Do you want to edit the company data ?"), { + confirm_callback: function () { + editor.editor_bar.save_without_reload().then(function () { + proto.__link_deferred.then(function (link) { + window.location.href = link; + }); + }); + }, + }); + }, }); options.registry.slider = options.Class.extend({ diff --git a/addons/website/views/snippets.xml b/addons/website/views/snippets.xml index a1cbb1b4578..cff4d7ed4a8 100644 --- a/addons/website/views/snippets.xml +++ b/addons/website/views/snippets.xml @@ -874,7 +874,7 @@ data-no-check="true"/>