[FIX] web_editor, website: combine dataset "image" and "img" keys
Commit [1] introduced a new "image" option instead of fixing the "img" option which already existed. Also it created a <img> tag with a "fa-fw" class which does not make much sense. Also, our system with data-img actually creates a <svg> tag so that the color of the icon is the one decided in our SCSS instead of the one hardcoded in the image and so that there is an hover effect. [1]: https://github.com/odoo/odoo/commit/02ccad3200187724d5f133842032981fb91f7465 closes odoo/odoo#75743 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -902,19 +902,15 @@ const SelectUserValueWidget = BaseSelectionUserValueWidget.extend({
|
||||
}
|
||||
|
||||
this.menuTogglerEl = document.createElement('we-toggler');
|
||||
this.icon = this.el.dataset.icon || false;
|
||||
this.image = this.el.dataset.image || false;
|
||||
if (this.icon) {
|
||||
this.iconEl = this.imgEl || null;
|
||||
const icon = this.el.dataset.icon;
|
||||
if (icon) {
|
||||
this.iconEl = document.createElement('i');
|
||||
this.iconEl.classList.add('fa', 'fa-fw', icon);
|
||||
}
|
||||
if (this.iconEl) {
|
||||
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);
|
||||
} else if (this.image) {
|
||||
this.el.classList.add('o_we_icon_select');
|
||||
const imgEl = document.createElement('img');
|
||||
imgEl.src = this.image;
|
||||
imgEl.classList.add('fa-fw');
|
||||
this.menuTogglerEl.appendChild(imgEl);
|
||||
this.menuTogglerEl.appendChild(this.iconEl);
|
||||
}
|
||||
this.containerEl.insertBefore(this.menuTogglerEl, this.menuEl);
|
||||
|
||||
@@ -955,7 +951,7 @@ const SelectUserValueWidget = BaseSelectionUserValueWidget.extend({
|
||||
async setValue() {
|
||||
await this._super(...arguments);
|
||||
|
||||
if (this.icon || this.image) {
|
||||
if (this.iconEl) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
|
||||
<g transform="translate(0,1280) scale(0.1,-0.1)">
|
||||
<path fill="white" d="M6125 11184 c-953 -60 -1851 -388 -2595 -948 -269 -203 -593 -507
|
||||
-791 -746 -641 -770 -1007 -1643 -1111 -2650 -17 -164 -17 -716 0 -880 118
|
||||
-1151 590 -2150 1391 -2950 384 -383 783 -668 1272 -910 638 -315 1326 -480
|
||||
2009 -484 200 -1 245 2 299 17 279 79 491 291 567 568 25 89 25 308 0 399 -23
|
||||
87 -86 214 -136 275 -190 233 -242 360 -243 590 -1 149 17 223 85 363 102 209
|
||||
287 359 523 424 77 21 102 22 755 28 724 7 746 9 986 65 659 155 1233 555
|
||||
1609 1120 388 583 519 1238 405 2020 -182 1242 -967 2345 -2159 3029 -615 354
|
||||
-1312 574 -2061 651 -147 16 -668 28 -805 19z m-850 -1068 c385 -106 639 -477
|
||||
595 -869 -23 -199 -107 -367 -254 -504 -393 -368 -1035 -251 -1272 232 -58
|
||||
118 -75 187 -81 321 -6 133 12 242 60 354 104 241 318 418 572 474 90 20 295
|
||||
15 380 -8z m2623 8 c316 -64 563 -314 628 -634 20 -99 15 -272 -10 -365 -43
|
||||
-158 -160 -334 -289 -430 -369 -279 -888 -202 -1152 170 -224 316 -194 742 73
|
||||
1027 78 84 217 172 327 208 126 42 291 51 423 24z m-4314 -2124 c322 -47 581
|
||||
-282 667 -605 29 -111 29 -279 0 -390 -144 -547 -769 -786 -1236 -474 -147 98
|
||||
-255 242 -317 420 -31 90 -33 100 -33 249 0 149 2 159 33 250 46 134 101 221
|
||||
201 321 185 185 428 266 685 229z m5960 -19 c131 -34 247 -102 352 -206 106
|
||||
-104 158 -188 206 -325 31 -91 33 -101 33 -250 0 -149 -2 -159 -33 -249 -62
|
||||
-178 -170 -322 -317 -420 -467 -312 -1092 -73 -1236 474 -29 111 -29 279 0
|
||||
390 84 319 341 554 659 605 84 13 246 4 336 -19z"/>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="23" height="23" viewBox="0 0 23 23" version="1.1">
|
||||
<g fill="#FFF">
|
||||
<path class="o_graphic" d="M 11 2.9 C 9.3 3 7.7 3.6 6.3 4.6 C 5.9 5 5.3 5.5 4.9 5.9 C 3.8 7.3 3.1 8.9 2.9 10.7 C 2.9 11 2.9 12 2.9 12.3 C 3.1 14.4 4 16.2 5.4 17.6 C 6.1 18.3 6.8 18.8 7.7 19.2 C 8.9 19.8 10.1 20.1 11.3 20.1 C 11.7 20.1 11.8 20.1 11.9 20.1 C 12.4 19.9 12.7 19.5 12.9 19 C 12.9 18.9 12.9 18.5 12.9 18.3 C 12.8 18.2 12.7 17.9 12.6 17.8 C 12.3 17.4 12.2 17.2 12.2 16.8 C 12.2 16.5 12.2 16.4 12.3 16.1 C 12.5 15.7 12.9 15.5 13.3 15.4 C 13.4 15.3 13.5 15.3 14.6 15.3 C 15.9 15.3 16 15.3 16.4 15.2 C 17.6 14.9 18.6 14.2 19.3 13.2 C 20 12.1 20.2 11 20 9.6 C 19.7 7.3 18.3 5.3 16.2 4.1 C 15.1 3.5 13.8 3.1 12.5 2.9 C 12.2 2.9 11.3 2.9 11 2.9 Z M 9.5 4.8 C 10.2 5 10.6 5.7 10.5 6.4 C 10.5 6.7 10.4 7 10.1 7.3 C 9.4 8 8.2 7.7 7.8 6.9 C 7.7 6.7 7.7 6.5 7.7 6.3 C 7.6 6.1 7.7 5.9 7.8 5.7 C 8 5.2 8.3 4.9 8.8 4.8 C 9 4.8 9.3 4.8 9.5 4.8 Z M 14.2 4.8 C 14.8 4.9 15.2 5.4 15.3 5.9 C 15.4 6.1 15.3 6.4 15.3 6.6 C 15.2 6.9 15 7.2 14.8 7.4 C 14.1 7.9 13.2 7.7 12.7 7.1 C 12.3 6.5 12.4 5.7 12.8 5.2 C 13 5.1 13.2 4.9 13.4 4.9 C 13.7 4.8 14 4.8 14.2 4.8 Z M 6.4 8.6 C 7 8.7 7.5 9.1 7.6 9.7 C 7.7 9.9 7.7 10.2 7.6 10.4 C 7.4 11.4 6.3 11.8 5.4 11.3 C 5.2 11.1 5 10.8 4.8 10.5 C 4.8 10.3 4.8 10.3 4.8 10.1 C 4.8 9.8 4.8 9.8 4.8 9.6 C 4.9 9.4 5 9.2 5.2 9 C 5.5 8.7 6 8.6 6.4 8.6 Z M 17.1 8.7 C 17.4 8.7 17.6 8.8 17.8 9 C 18 9.2 18.1 9.4 18.2 9.6 C 18.2 9.8 18.2 9.8 18.2 10.1 C 18.2 10.3 18.2 10.3 18.2 10.5 C 18 10.8 17.8 11.1 17.6 11.3 C 16.7 11.8 15.6 11.4 15.4 10.4 C 15.3 10.2 15.3 9.9 15.4 9.7 C 15.5 9.1 16 8.7 16.5 8.6 C 16.7 8.6 17 8.6 17.1 8.7 Z M 17.1 8.7 "/>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1238,7 +1238,7 @@
|
||||
data-use-css-color="true" data-selected-tab="custom-colors"/>
|
||||
<we-colorpicker data-customize-website-color="" data-color="o-color-5"
|
||||
data-use-css-color="true" data-selected-tab="custom-colors"/>
|
||||
<we-select data-image="/website/static/src/img/snippets_options/palette.svg" class="o_we_theme_colors_select" data-variable="color-palettes-name"/>
|
||||
<we-select data-img="/website/static/src/img/snippets_options/palette.svg" class="o_we_theme_colors_select" data-variable="color-palettes-name"/>
|
||||
</we-row>
|
||||
</div>
|
||||
<div data-js="OptionsTab" data-selector="theme-options" data-no-check="true">
|
||||
|
||||
Reference in New Issue
Block a user