[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
This commit is contained in:
qsm-odoo
2020-05-31 13:37:03 +00:00
parent a5d59de84b
commit 5c16c86cd5
@@ -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;
},
//--------------------------------------------------------------------------