Skip to content

Commit a22e22a

Browse files
[IMP] html_builder, *: rename Img component to Image
*: mass_mailing, website, website_sale The `Img` component has a confusing name, because in templates it looks too similar to the HTML tag `<img>`. To improve clarity, this commit changes the name to `Image`. task-5345698 closes #238718 Related: odoo/enterprise#101359 Related: odoo/design-themes#1187 Signed-off-by: Francois Georis (fge) <[email protected]>
1 parent 93d0931 commit a22e22a

File tree

26 files changed

+86
-86
lines changed

26 files changed

+86
-86
lines changed

addons/html_builder/static/src/core/builder_component_plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { BuilderMany2Many } from "./building_blocks/builder_many2many";
1919
import { BuilderMany2One } from "./building_blocks/builder_many2one";
2020
import { ModelMany2Many } from "./building_blocks/model_many2many";
2121
import { Plugin } from "@html_editor/plugin";
22-
import { Img } from "./img";
22+
import { Image } from "./img";
2323
import { BuilderUrlPicker } from "./building_blocks/builder_urlpicker";
2424
import { BuilderFontFamilyPicker } from "./building_blocks/builder_fontfamilypicker";
2525

@@ -60,7 +60,7 @@ export class BuilderComponentPlugin extends Plugin {
6060
ModelMany2Many,
6161
BuilderDateTimePicker,
6262
BuilderList,
63-
Img,
63+
Image,
6464
},
6565
};
6666

addons/html_builder/static/src/core/building_blocks/builder_button.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
useSelectableItemComponent,
66
} from "../utils";
77
import { BuilderComponent } from "./builder_component";
8-
import { Img } from "../img";
8+
import { Image } from "../img";
99

1010
export class BuilderButton extends Component {
1111
static template = "html_builder.BuilderButton";
12-
static components = { BuilderComponent, Img };
12+
static components = { BuilderComponent, Image };
1313
static props = {
1414
...clickableBuilderComponentProps,
1515

addons/html_builder/static/src/core/building_blocks/builder_button.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
t-on-click="() => this.onClick()"
1919
t-on-pointerenter="() => this.onPointerEnter(props.id)"
2020
t-on-pointerleave="() => this.onPointerLeave(props.id)">
21-
<Img t-if="props.iconImg" src="props.iconImg" attrs="{alt:props.iconImgAlt}"/>
21+
<Image t-if="props.iconImg" src="props.iconImg" attrs="{alt:props.iconImgAlt}"/>
2222
<i t-if="props.icon" t-att-class="iconClassName" role="img"/>
2323
<t t-if="props.label" t-out="props.label"/>
2424
<t t-slot="default"/>

addons/html_builder/static/src/core/img.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const svgCache = new Cache(async (src) => {
2929
return xmlDoc.getElementsByTagName("svg")[0];
3030
}, JSON.stringify);
3131

32-
export class Img extends Component {
32+
export class Image extends Component {
3333
static props = {
3434
src: String,
3535
class: { type: String, optional: true },
@@ -108,7 +108,7 @@ export class Img extends Component {
108108

109109
loadImage() {
110110
return new Promise((resolve, reject) => {
111-
const img = new Image();
111+
const img = new window.Image();
112112
img.onload = () => resolve({ status: "loaded" });
113113
img.onerror = () => resolve({ status: "error" });
114114
img.src = this.props.src;

addons/html_builder/static/src/plugins/background_option/background_shape_option.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
preview="false"
3636
className="'o-hb-btn-has-img-icon o_hb_device btn-danger-color-active'"
3737
t-if="state.hasShape">
38-
<Img src="'/html_builder/static/img/options/mobile_invisible.svg'" style="'width: 12px'" />
38+
<Image src="'/html_builder/static/img/options/mobile_invisible.svg'" style="'width: 12px'" />
3939
</BuilderButton>
4040
</BuilderRow>
4141

addons/html_builder/static/src/plugins/rating_option.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
</BuilderRow>
2828
<BuilderRow label.translate="Size">
2929
<BuilderButtonGroup applyTo="'.s_rating_icons'">
30-
<BuilderButton classAction="''" title.translate="Small"><Img src="'/html_builder/static/img/options/size_small.svg'" /></BuilderButton>
31-
<BuilderButton classAction="'fa-2x'" title.translate="Medium"><Img src="'/html_builder/static/img/options/size_medium.svg'" /></BuilderButton>
32-
<BuilderButton classAction="'fa-3x'" title.translate="Large"><Img src="'/html_builder/static/img/options/size_large.svg'" /></BuilderButton>
30+
<BuilderButton classAction="''" title.translate="Small"><Image src="'/html_builder/static/img/options/size_small.svg'" /></BuilderButton>
31+
<BuilderButton classAction="'fa-2x'" title.translate="Medium"><Image src="'/html_builder/static/img/options/size_medium.svg'" /></BuilderButton>
32+
<BuilderButton classAction="'fa-3x'" title.translate="Large"><Image src="'/html_builder/static/img/options/size_large.svg'" /></BuilderButton>
3333
</BuilderButtonGroup>
3434
</BuilderRow>
3535
<BuilderRow label.translate="Title Position">

addons/html_builder/static/src/plugins/shape/shape_selector.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="o_we_shape" t-att-class="this.getShapeClass(shape[0])"/>
2727
</t>
2828
<t t-else="" >
29-
<Img src="this.getShapeUrl(shape[0])" svgCheck="false"/>
29+
<Image src="this.getShapeUrl(shape[0])" svgCheck="false"/>
3030
</t>
3131
<span t-if="shape[1].imgSize" class="o_we_shape_animated_label">
3232
<i class="fa fa-expand"></i>

addons/html_builder/static/src/sidebar/custom_inner_snippet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Img } from "@html_builder/core/img";
1+
import { Image } from "@html_builder/core/img";
22
import { Component, useState, useRef } from "@odoo/owl";
33
import { _t } from "@web/core/l10n/translation";
44
import { useAutofocus } from "@web/core/utils/hooks";
@@ -11,7 +11,7 @@ export class CustomInnerSnippet extends Component {
1111
onClickHandler: { type: Function },
1212
disabledTooltip: { type: String },
1313
};
14-
static components = { Img };
14+
static components = { Image };
1515

1616
setup() {
1717
this.renameInputRef = useRef("rename-input");

addons/html_builder/static/src/sidebar/custom_inner_snippet.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
t-att-data-tooltip="snippet.isDisabled and props.disabledTooltip">
1111
<div class="o_snippet_thumbnail" t-att-data-snippet="snippet.name">
1212
<button t-if="!snippet.isInstallable" class="o_snippet_thumbnail_area" t-on-click="props.onClickHandler" title="Insert snippet"/>
13-
<Img t-if="snippet.isDisabled" src="'/html_builder/static/img/snippet_disabled.svg'" class="'o_snippet_undroppable'"/>
13+
<Image t-if="snippet.isDisabled" src="'/html_builder/static/img/snippet_disabled.svg'" class="'o_snippet_undroppable'"/>
1414
<div class="o_snippet_thumbnail_img" t-attf-style="background-image: url({{snippet.thumbnailSrc}});"/>
1515
<t t-if="state.isRenaming">
1616
<div class="rename-input w-100 mx-1 z-1">

addons/html_builder/static/src/sidebar/customize_component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Component } from "@odoo/owl";
22
import { useOptionsSubEnv } from "@html_builder/utils/utils";
3-
import { Img } from "@html_builder/core/img";
3+
import { Image } from "@html_builder/core/img";
44

55
export class CustomizeComponent extends Component {
66
static template = "html_builder.CustomizeComponent";
7-
static components = { Img };
7+
static components = { Image };
88
static props = {
99
editingElements: { type: Array },
1010
comp: { type: Function },

0 commit comments

Comments
 (0)