diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-05-28 10:04:28 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-05-31 13:36:53 +0000 |
| commit | a5d59de84b99d733f48fe779f6e154bb6c15fdbf (patch) | |
| tree | f42c97e4fc78d41fd006721b884db74e00ccedb4 /addons/web_editor/static/src/js/editor | |
| parent | 3d20d36bad8b4bb9f71e5e4df576b144d19778c9 (diff) | |
[IMP] web_editor: allow left-panel select to have an unique icon label
Part of https://github.com/odoo/odoo/pull/52211
Related to task-2197038
Diffstat (limited to 'addons/web_editor/static/src/js/editor')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.options.js | 12 |
1 files changed, 12 insertions, 0 deletions
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 50b56ad435a..779e01419a7 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -636,6 +636,13 @@ const SelectUserValueWidget = UserValueWidget.extend({ } this.menuTogglerEl = document.createElement('we-toggler'); + this.icon = this.el.dataset.icon || false; + if (this.icon) { + this.el.classList.add('o_we_icon_select'); + const iconEl = document.createElement('i'); + iconEl.classList.add('fa', 'fa-fw', this.icon); + this.menuTogglerEl.appendChild(iconEl); + } this.containerEl.appendChild(this.menuTogglerEl); this.menuEl = document.createElement('we-select-menu'); @@ -710,6 +717,11 @@ const SelectUserValueWidget = UserValueWidget.extend({ */ _updateUI: async function () { await this._super(...arguments); + + if (this.icon) { + return; + } + const activeWidget = this._userValueWidgets.find(widget => !widget.isPreviewed() && widget.isActive()); this.menuTogglerEl.textContent = activeWidget ? activeWidget.el.textContent : "/"; }, |
