From 53e428aa454326d98dad718dfa7be73f7cd06c41 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 9 Sep 2019 10:34:33 +0000 Subject: [PATCH] [REF] website: remove anchor option on columns The anchor option was available on column so that you can target a column which wraps on a new line in mobile... but we decided to remove the feature as it complexify the UI. Also fix a small bug: it was not possible to hit "save" when not changing the anchor name of an element (an error message was displayed to say it is already used in the page... while it is in fact used by itself). Part of https://github.com/odoo/odoo/pull/36515 --- addons/website/static/src/js/editor/snippets.options.js | 7 +++++++ addons/website/views/snippets.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 761fae6f816..3b75e99d367 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -1492,6 +1492,13 @@ options.registry.anchorName = options.Class.extend({ click: function () { var $input = this.$('.o_input_anchor_name'); var anchorName = $input.val().trim().replace(/\s/g, '_'); + if (self.$target[0].id === anchorName) { + // If the chosen anchor name is already the one used by the + // element, close the dialog and do nothing else + this.close(); + return; + } + var isValid = /^[\w-]+$/.test(anchorName); var alreadyExists = isValid && $('#' + anchorName).length > 0; var anchorOK = isValid && !alreadyExists; diff --git a/addons/website/views/snippets.xml b/addons/website/views/snippets.xml index 1e4e72dd4f7..5beb1bc2980 100644 --- a/addons/website/views/snippets.xml +++ b/addons/website/views/snippets.xml @@ -1444,7 +1444,7 @@
Link Anchor