Skip to content

Commit 8566d12

Browse files
committed
[IMP] WIP
1 parent fb154d3 commit 8566d12

File tree

10 files changed

+56
-25
lines changed

10 files changed

+56
-25
lines changed

addons/mass_mailing/views/snippets/s_hr.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
33

4-
<template id="s_hr" name="Separator" inherit_id="web_editor.s_hr" primary="True">
5-
<xpath expr="//div[hasclass('s_hr')]" position="attributes">
6-
<attribute name="class" add="o_mail_snippet_general pt16 pb16" remove="pt32 pb32" separator=" "/>
7-
</xpath>
8-
<xpath expr="//hr" position="attributes">
9-
<attribute name="class" remove="w-100 mx-auto" separator=" "/>
10-
</xpath>
4+
<template id="s_hr" name="Separator">
5+
<div class="s_hr o_mail_snippet_general pt16 pb16">
6+
<hr class="w-100 mx-auto"/>
7+
</div>
118
</template>
129

1310
<template id="s_hr_options" inherit_id="mass_mailing.snippet_options">

addons/mass_mailing_egg/static/src/builder/mass_mailing_builder.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { removePlugins } from "@html_builder/utils/utils";
44
import { Component } from "@odoo/owl";
55
import { registry } from "@web/core/registry";
66
import { DYNAMIC_PLACEHOLDER_PLUGINS } from "@html_editor/backend/plugin_sets";
7+
import { MassMailingColorPlugin } from "./plugins/color_plugin";
78

89
export class MassMailingBuilder extends Component {
910
static template = "mass_mailing_egg.MassMailingBuilder";
@@ -18,13 +19,18 @@ export class MassMailingBuilder extends Component {
1819
...registry.category("builder-plugins").getAll(),
1920
// TODO EGGMAIL: use this registry for mass_mailing exclusive plugins
2021
...registry.category("mass_mailing-plugins").getAll(),
22+
MassMailingColorPlugin,
2123
]);
2224
// TODO EGGMAIL: copied from website, check if something needs to be changed here
2325
const pluginsToRemove = [
2426
"BuilderFontPlugin", // Makes call to Google API (can't be used for emails)
2527
"SavePlugin",
2628
"SaveSnippetPlugin",
2729
"AnchorPlugin",
30+
"ColorPlugin",
31+
"EmbeddedFilePlugin",
32+
"FilePlugin",
33+
"AddDocumentsAttachmentPlugin",
2834
];
2935
const builderEditorPlugins = new Set(removePlugins([...CORE_PLUGINS], pluginsToRemove));
3036
const optionalPlugins = new Set([

addons/mass_mailing_egg/static/src/builder/options/alert_option.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</BuilderSelect>
99
</BuilderRow>
1010
<BuilderRow label.translate="Background Color">
11-
<BuilderColorPicker colorPrefix="'alert-'" styleAction="'background-color'"/>
11+
<BuilderColorPicker styleAction="'background-color'" enabledTabs="['solid', 'custom']"/>
1212
</BuilderRow>
1313
</t>
1414
</templates>

addons/mass_mailing_egg/static/src/builder/plugins/border_option_plugin.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export class BorderOptionPlugin extends Plugin {
1313
".s_three_columns .row > div, .s_comparisons .row > div, .s_mail_block_event .row > div",
1414
applyTo: ".card",
1515
}),
16+
withSequence(before(WIDTH), {
17+
template: "mass_mailing.BorderOption",
18+
selector: ".s_text_block",
19+
}),
1620
withSequence(before(WIDTH), {
1721
template: "mass_mailing.BorderOption",
1822
selector: ".o_mail_block_discount2",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ColorPlugin } from "@html_builder/core/color_plugin";
2+
3+
export class MassMailingColorPlugin extends ColorPlugin {
4+
getPropsForColorSelector(type) {
5+
const props = { ...super.getPropsForColorSelector(type) };
6+
props.enabledTabs = ["solid", "custom"];
7+
return props;
8+
}
9+
}

addons/mass_mailing_egg/static/src/builder/plugins/customize_mailing_variables.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ const textProperties = [
4444
];
4545

4646
const buttonProperties = [
47-
"font-size",
48-
"color",
47+
...textProperties,
4948
"background-color",
5049
"padding-x",
5150
"padding-y",
52-
"font-family",
5351
"border-style",
5452
"border-width",
5553
"border-color",
@@ -78,7 +76,11 @@ export const CUSTOMIZE_MAILING_VARIABLES = Object.assign(
7876
[`.${BASE_CONTAINER_CLASS}`, `.${BASE_CONTAINER_CLASS} > *`, "p", "p > *", "li", "li > *"],
7977
textProperties
8078
),
81-
generateSimpleMailingVariables("link", ["a:not(.btn)", "a.btn.btn-link"], textProperties),
79+
generateSimpleMailingVariables(
80+
"link",
81+
["a:not(.btn):not(.fa)", "a.btn.btn-link"],
82+
textProperties
83+
),
8284
generateSimpleMailingVariables(
8385
"btn-primary",
8486
["a.btn.btn-fill-primary", "a.btn.btn-outline-primary", "a.btn.btn-primary"],

addons/mass_mailing_egg/static/src/builder/plugins/horizontal_padding_option_plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { withSequence } from "@html_editor/utils/resource";
66
class HorizontalPaddingOptionPlugin extends Plugin {
77
static id = "horizontalPaddingOption";
88
selector =
9-
"[class*='col-lg-'], .s_discount2, .s_text_block, .s_media_list, .s_picture, .s_rating";
9+
"[class*='col-lg-'], .s_discount2, .s_text_block, .s_media_list, .s_picture, .s_rating, .s_title";
1010
resources = {
1111
mark_color_level_selector_params: [{ selector: this.selector }],
1212
builder_options: [

addons/mass_mailing_egg/static/src/builder/plugins/image_tool_options_plugin.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { ImageToolOption } from "@html_builder/plugins/image/image_tool_option";
2+
import { CropImageAction } from "@html_builder/plugins/image/image_tool_option_plugin";
23
import { Plugin } from "@html_editor/plugin";
4+
import { closestElement } from "@html_editor/utils/dom_traversal";
35
import { registry } from "@web/core/registry";
6+
import { patch } from "@web/core/utils/patch";
47

58
class ImageToolOptionPlugin extends Plugin {
69
static id = "mass_mailing.ImageToolOption";
@@ -23,12 +26,19 @@ class ImageToolOptionPlugin extends Plugin {
2326
method: "replace",
2427
value: MassMailingImageToolOption,
2528
},
26-
]
27-
}
29+
],
30+
};
2831
}
2932

30-
class MassMailingImageToolOption extends ImageToolOption {
33+
export class MassMailingImageToolOption extends ImageToolOption {
3134
static template = "mass_mailing.ImageToolOption";
3235
}
3336

37+
patch(CropImageAction.prototype, {
38+
setup() {
39+
this.withLoadingEffect =
40+
closestElement(this.editable, ".o_mass_mailing_with_builder") !== null;
41+
},
42+
});
43+
3444
registry.category("mass_mailing-plugins").add(ImageToolOptionPlugin.id, ImageToolOptionPlugin);

addons/mass_mailing_egg/static/src/builder/tabs/design_tab.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
</BuilderButton>
3434
</BuilderButtonGroup>
3535
</BuilderRow>
36-
<BuilderRow label.translate="Mailing Background">
36+
<BuilderRow label.translate="Mailing Background" extraLabelClass="'pe-2'">
3737
<BuilderColorPicker noTransparency="true"
3838
enabledTabs="['solid', 'custom']"
3939
styleAction="'background-color'"
4040
applyTo="'.o_layout'"
4141
/>
4242
</BuilderRow>
43-
<BuilderRow label.translate="Content Background">
43+
<BuilderRow label.translate="Content Background" extraLabelClass="'pe-2'">
4444
<BuilderColorPicker noTransparency="true"
4545
enabledTabs="['solid', 'custom']"
4646
action="'mass_mailing_egg.CustomizeMailingVariable'"
@@ -76,7 +76,7 @@
7676
<BuilderContext action="'mass_mailing_egg.CustomizeMailingVariable'">
7777
<BuilderRow label="label" extraLabelClass="'fw-bolder'">
7878
<BuilderNumberInput actionParam="{ variable: `${prefix}font-size` }" unit="'px'" saveUnit="'px'" default="0"/>
79-
<BuilderColorPicker noTransparency="true" colorPrefix="'text-'" title.translate="Text Color" enabledTabs="['solid', 'custom']"
79+
<BuilderColorPicker noTransparency="true" title.translate="Text Color" enabledTabs="['solid', 'custom']"
8080
actionParam="{ variable: `${prefix}color` }"/>
8181
</BuilderRow>
8282
<BuilderRow>
@@ -92,9 +92,9 @@
9292
<BuilderContext action="'mass_mailing_egg.CustomizeMailingVariable'">
9393
<BuilderRow label="label" extraLabelClass="'fw-bolder'">
9494
<BuilderNumberInput actionParam="{ variable: `${prefix}font-size` }" unit="'px'" saveUnit="'px'" default="0"/>
95-
<BuilderColorPicker noTransparency="true" colorPrefix="'text-'" title.translate="Text Color" enabledTabs="['solid', 'custom']"
95+
<BuilderColorPicker noTransparency="true" title.translate="Text Color" enabledTabs="['solid', 'custom']"
9696
actionParam="{ variable: `${prefix}color` }"/>
97-
<BuilderColorPicker noTransparency="true" colorPrefix="'bg-'" title.translate="Background Color" enabledTabs="['solid', 'custom']"
97+
<BuilderColorPicker noTransparency="true" title.translate="Background Color" enabledTabs="['solid', 'custom']"
9898
actionParam="{ variable: `${prefix}background-color` }"/>
9999
</BuilderRow>
100100
<BuilderRow label.translate="Padding" level="1">
@@ -103,6 +103,9 @@
103103
</BuilderRow>
104104
<BuilderRow label.translate="Font Family" level="1">
105105
<FontFamilyPicker action="'mass_mailing_egg.CustomizeMailingVariable'" actionParam="{ variable: `${prefix}font-family`}"/>
106+
<BuilderButton icon="'fa-fw fa-bold'" actionParam="{ variable: `${prefix}font-weight` }" actionValue="'bolder'"/>
107+
<BuilderButton icon="'fa-fw fa-italic'" actionParam="{ variable: `${prefix}font-style` }" actionValue="'italic'"/>
108+
<BuilderButton icon="'fa-fw fa-underline'" actionParam="{ variable: `${prefix}text-decoration-line`}" actionValue="'underline'"/>
106109
</BuilderRow>
107110
<BuilderRow label.translate="Border" level="1">
108111
<BuilderNumberInput actionParam="{ variable: `${prefix}border-width` }" unit="'px'" saveUnit="'px'" min="0"
@@ -114,7 +117,7 @@
114117
<BuilderSelectItem title.translate="Double" actionValue="'double'"><div class="o-hb-border-preview" style="border-style: double;"/></BuilderSelectItem>
115118
</BuilderSelect>
116119
<BuilderColorPicker actionParam="{ variable: `${prefix}border-color` }"
117-
colorPrefix="'border-'" noTransparency="true"
120+
noTransparency="true"
118121
enabledTabs="['solid', 'custom']"
119122
/>
120123
</BuilderRow>
@@ -145,7 +148,7 @@
145148
<BuilderSelectItem title.translate="Double" actionValue="'double'"><div class="o-hb-border-preview" style="border-style: double;"/></BuilderSelectItem>
146149
</BuilderSelect>
147150
<BuilderColorPicker actionParam="{ variable: `${prefix}border-color` }"
148-
colorPrefix="'border-'" noTransparency="true"
151+
noTransparency="true"
149152
enabledTabs="['solid', 'custom']"
150153
/>
151154
</BuilderRow>

addons/mass_mailing_themes/views/mass_mailing_themes_templates.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,8 @@
10671067

10681068
--text-font-size: 16px;
10691069

1070-
--text-text-decoration-line: underline;
1071-
--text-color: #212529;
1070+
--link-text-decoration-line: underline;
1071+
--link-color: #212529;
10721072

10731073
--btn-primary-background-color: #CE0000;
10741074
--btn-primary-border-color: #CE0000;

0 commit comments

Comments
 (0)