From 5c16c86cd570cc07d3a5db0fb6c9f9acd140722b Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 28 May 2020 10:04:30 +0000 Subject: [PATCH] [IMP] web_editor: allow left-panel select to have custom active labels Instead of the text of the selected option displayed as label, we may want another text (especially if the choice has long text). This can be defined on buttons with 'data-select-label'. Part of https://github.com/odoo/odoo/pull/52211 Related to task-2197038 --- addons/web_editor/static/src/js/editor/snippets.options.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 779e01419a7..b3502bb2c71 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -723,7 +723,11 @@ const SelectUserValueWidget = UserValueWidget.extend({ } const activeWidget = this._userValueWidgets.find(widget => !widget.isPreviewed() && widget.isActive()); - this.menuTogglerEl.textContent = activeWidget ? activeWidget.el.textContent : "/"; + let value = "/"; + if (activeWidget) { + value = activeWidget.el.dataset.selectLabel || activeWidget.el.textContent; + } + this.menuTogglerEl.textContent = value; }, //--------------------------------------------------------------------------