Skip to content

Commit edf4e37

Browse files
committed
WIP
1 parent 4d7a7e8 commit edf4e37

19 files changed

+232
-83
lines changed

addons/html_builder/static/src/plugins/border_configurator_option.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ export class BorderConfigurator extends BaseOptionComponent {
1818
setup() {
1919
super.setup();
2020
this.getItemValue = useGetItemValue();
21-
this.parseInt = parseInt;
2221
this.state = useDomState((editingElement) => ({
2322
hasBorder: this.hasBorder(editingElement),
2423
}));
2524
}
25+
26+
get showBorderRadiusOption() {
27+
return this.props.withRoundCorner && parseInt(this.getItemValue("border_width_opt")) > 0;
28+
}
29+
2630
getStyleActionParam(param) {
2731
return `border-${this.props.direction ? this.props.direction + "-" : ""}${param}`;
2832
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</BuilderRow>
1818

1919
<!-- TODO: handle the dependency with border_width_opt bg_color_opt-->
20-
<BuilderRow t-if="props.withRoundCorner and parseInt(this.getItemValue('border_width_opt')) > 0" label.translate="Round Corners">
20+
<BuilderRow t-if="showBorderRadiusOption" label.translate="Round Corners">
2121
<BuilderNumberInput action="props.action" actionParam="{ mainParam: 'border-radius', extraClass: props.withBSClass and 'rounded' }" unit="'px'" default="0" min="0" composable="true"/>
2222
</BuilderRow>
2323
</t>

addons/html_builder/static/src/plugins/vertical_alignment_option_plugin.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ import { VerticalAlignmentOption } from "@html_builder/plugins/vertical_alignmen
55
import { withSequence } from "@html_editor/utils/resource";
66
import { VERTICAL_ALIGNMENT } from "@html_builder/utils/option_sequence";
77

8-
class VerticalAlignmentOptionPlugin extends Plugin {
8+
export class VerticalAlignmentOptionPlugin extends Plugin {
99
static id = "verticalAlignmentOption";
1010
resources = {
1111
builder_options: [
1212
withSequence(VERTICAL_ALIGNMENT, {
1313
OptionComponent: VerticalAlignmentOption,
14-
selector:
15-
".s_text_image, .s_image_text, .s_three_columns, .s_showcase, .s_numbers, .s_faq_collapse, .s_references, .s_accordion_image, .s_shape_image",
14+
selector: this.selector,
1615
applyTo: ".row",
1716
props: {
1817
level: 1,
@@ -23,6 +22,9 @@ class VerticalAlignmentOptionPlugin extends Plugin {
2322
SetVerticalAlignmentAction,
2423
},
2524
};
25+
get selector() {
26+
return ".s_text_image, .s_image_text, .s_three_columns, .s_showcase, .s_numbers, .s_faq_collapse, .s_references, .s_accordion_image, .s_shape_image";
27+
}
2628
}
2729

2830
export class SetVerticalAlignmentAction extends ClassAction {

addons/mass_mailing/views/snippets_themes.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
<!-- Snippet Templates -->
8484
<template id="s_mail_block_header_social" name="Left Logo">
85-
<section class="s_header_social o_mail_block_header_social o_mail_snippet_general pt16 pb16">
85+
<section class="s_header_social o_mail_block_header_social o_mail_snippet_general pt16 pb16" data-name="Left Logo">
8686
<div class="container">
8787
<div class="row">
8888
<div class="col-lg-4 pt16 pb16">
@@ -99,7 +99,7 @@
9999
</template>
100100

101101
<template id="s_mail_block_header_text_social" name="Left Text">
102-
<section class="s_header_text_social o_mail_block_header_text_social o_mail_snippet_general">
102+
<section class="s_header_text_social o_mail_block_header_text_social o_mail_snippet_general" data-name="Left Text">
103103
<div class="container">
104104
<div class="row">
105105
<div class="col-lg-4 pt16 pb16">
@@ -118,7 +118,7 @@
118118
</template>
119119

120120
<template id="s_mail_block_header_logo" name="Centered Logo">
121-
<section class="s_header_logo o_mail_block_header_logo o_mail_snippet_general">
121+
<section class="s_header_logo o_mail_block_header_logo o_mail_snippet_general" data-name="Centered Logo">
122122
<div class="container">
123123
<div class="row">
124124
<div class="col-lg-3"/>
@@ -134,15 +134,15 @@
134134
</template>
135135

136136
<template id="s_mail_block_header_view" name="View Online">
137-
<section class="o_snippet_view_in_browser o_mail_snippet_general pt16 pb16" style="text-align: center; padding-left: 15px; padding-right: 15px;">
137+
<section class="o_snippet_view_in_browser o_mail_snippet_general pt16 pb16" style="text-align: center; padding-left: 15px; padding-right: 15px;" data-name="View Online">
138138
<a href="/view">
139139
View Online
140140
</a>
141141
</section>
142142
</template>
143143

144144
<template id="s_mail_block_discount1" name="Discount Offer">
145-
<section class="s_discount1 o_mail_block_discount1 o_mail_snippet_general pt0 pb16">
145+
<section class="s_discount1 o_mail_block_discount1 o_mail_snippet_general pt0 pb16" data-name="Discount Offer">
146146
<div class="container">
147147
<div class="row">
148148
<div class="col-lg-6 pt16">
@@ -160,8 +160,8 @@
160160
</section>
161161
</template>
162162

163-
<template id="s_mail_block_footer_social" name="Footer Center">
164-
<section class="s_footer_social o_mail_block_footer_social o_mail_footer_social_center o_mail_snippet_general bg-200 pt16">
163+
<template id="s_mail_block_footer_social">
164+
<section class="s_footer_social o_mail_block_footer_social o_mail_footer_social_center o_mail_snippet_general bg-200 pt16" data-name="Footer Center">
165165
<div class="container">
166166
<div class="row">
167167
<div class="col-lg o_mail_footer_social" style="text-align: center;">
@@ -185,7 +185,7 @@
185185
</template>
186186

187187
<template id="s_mail_block_footer_social_left" name="Footer Left">
188-
<section class="s_footer_social o_mail_block_footer_social o_mail_footer_social_left o_mail_snippet_general pt16">
188+
<section class="s_footer_social o_mail_block_footer_social o_mail_footer_social_left o_mail_snippet_general pt16" data-name="Footer Left">
189189
<div class="container">
190190
<div class="row">
191191
<div class="col-lg o_mail_footer_description">

addons/mass_mailing/views/themes_templates.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
border-top-color: #ced4da !important;
3232
}
3333
</style>
34-
<section class="s_header_logo o_mail_block_header_logo o_mail_snippet_general pt16 pb16">
34+
<section class="s_header_logo o_mail_block_header_logo o_mail_snippet_general pt16 pb16" data-name="Centered Logo">
3535
<div class="container">
3636
<div class="row">
3737
<div class="col-lg-4"/>
@@ -44,7 +44,7 @@
4444
</div>
4545
</div>
4646
</section>
47-
<section class="s_text_block o_mail_snippet_general pt40 pb16" style="padding-left: 15px; padding-right: 15px;">
47+
<section class="s_text_block o_mail_snippet_general pt40 pb16" style="padding-left: 15px; padding-right: 15px;" data-name="Text">
4848
<div class="container s_allow_columns">
4949
<h2>Thank you for joining us!</h2>
5050
<p><br/>We want to take this opportunity to welcome you to our ever-growing community!

addons/mass_mailing_egg/snippets_progress_bar_WIP.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,34 +146,34 @@
146146
</we-button-group>
147147
</div>
148148

149-
<div data-js="table_row"
149+
<!-- <div data-js="table_row"
150150
data-selector="tr:has(> .row), tr:has(> .col_mv)"
151151
data-exclude=".o_mail_no_options"
152-
data-drop-near="tr:has(> .row), tr:has(> .col_mv)"/>
152+
data-drop-near="tr:has(> .row), tr:has(> .col_mv)"/> -->
153153

154154
<!-- <div data-js="table_column"
155155
data-selector=".col>td, .col>th"
156156
data-exclude=".o_mail_no_options"
157157
data-drop-near=".col>td, .col>th"/> -->
158158

159-
<div data-js="table_column_mv"
159+
<!-- <div data-js="table_column_mv"
160160
data-selector=".col_mv, td, th"
161161
data-exclude=".o_mail_no_options"
162-
data-drop-near=".col_mv, td, th"/>
162+
data-drop-near=".col_mv, td, th"/> -->
163163

164-
<t t-set="mailing_content_selector" t-translation="off">.note-editable > div:not(.o_layout), .note-editable .oe_structure > div, .oe_snippet_body</t>
165-
<div data-js="content"
164+
<!-- <t t-set="mailing_content_selector" t-translation="off">.note-editable > div:not(.o_layout), .note-editable .oe_structure > div, .oe_snippet_body</t> -->
165+
<!-- <div data-js="content"
166166
t-att-data-selector="mailing_content_selector"
167167
data-exclude=".o_mail_no_options"
168168
data-drop-near="[data-oe-field='body_html']:not(:has(.o_layout)) > *, .oe_structure > *"
169-
data-drop-in="[data-oe-field='body_html']:not(:has(.o_layout)), .oe_structure"/>
169+
data-drop-in="[data-oe-field='body_html']:not(:has(.o_layout)), .oe_structure"/> -->
170170

171-
<t t-set="so_snippet_addition_selector" t-translation="off">.o_mail_snippet_general</t>
171+
<!-- <t t-set="so_snippet_addition_selector" t-translation="off">.o_mail_snippet_general</t> -->
172172
<!-- <div id="so_snippet_addition"
173173
t-att-data-selector="so_snippet_addition_selector"
174174
data-drop-in=":not(p).oe_structure:not(.oe_structure_solo), :not(.o_mega_menu):not(p)[data-oe-type=html], :not(p).oe_structure.oe_structure_solo:not(:has(> section, > div))"/> -->
175175

176-
<t t-set="so_content_addition_selector" t-translation="off">.s_mail_blockquote, .s_mail_alert, .s_rating, .s_hr, .s_mail_text_highlight</t>
176+
<!-- <t t-set="so_content_addition_selector" t-translation="off">.s_mail_blockquote, .s_mail_alert, .s_rating, .s_hr, .s_mail_text_highlight</t> -->
177177
<!-- <div id="so_content_addition"
178178
t-att-data-selector="so_content_addition_selector"
179179
t-attf-data-drop-near="p, h1, h2, h3, ul, ol, .row > div > img, #{so_content_addition_selector}"

addons/mass_mailing_egg/static/src/builder/plugins/blockquote_option.xml renamed to addons/mass_mailing_egg/static/src/builder/options/blockquote_option.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<BuilderButton classAction="'o_height_800'">100%</BuilderButton>
1010
</BuilderButtonGroup>
1111
</BuilderRow>
12-
13-
<BuilderRow label.translate="Background Color">
14-
<BuilderColorPicker styleAction="'background-color'"/>
12+
</t>
13+
<t t-name="mass_mailing.ColorPickerOption">
14+
<BuilderRow label.translate="Background Color">
15+
<BuilderColorPicker styleAction="'background-color'" noTransparency="true" enabledTabs="['solid', 'custom']"/>
1516
</BuilderRow>
1617
</t>
17-
1818
</templates>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<templates>
2+
<t t-name="mass_mailing.BorderOption">
3+
<BorderConfiguratorOption label.translate="Border"/>
4+
</t>
5+
</templates>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<templates>
2+
<t t-name="mass_mailing.PaddingOption">
3+
<BuilderRow label.translate="Padding ↔">
4+
<BuilderNumberInput title.translate="Left" styleAction="'padding-left'" unit="'px'"/>
5+
<BuilderNumberInput title.translate="Right" styleAction="'padding-right'" unit="'px'"/>
6+
</BuilderRow>
7+
<t t-log="this"/>
8+
<BuilderRow label.translate="Padding ↔">
9+
<BuilderNumberInput title.translate="Left" styleAction="'padding-top'" unit="'px'"/>
10+
<BuilderNumberInput title.translate="Right" styleAction="'padding-bottom'" unit="'px'"/>
11+
</BuilderRow>
12+
</t>
13+
</templates>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Plugin } from "@html_editor/plugin";
2+
3+
class BorderOptionPlugin extends Plugin {
4+
static id = "mass_mailing.BorderOption";
5+
resources = {
6+
builder_options: [
7+
{
8+
template: "mass_mailing.BorderOption",
9+
selector: ".s_three_columns .row > div, .s_comparisons .row > div, .s_mail_block_event .row > div",
10+
exclude: ".o_mail_wrapper_td, .s_col_no_bgcolor, .s_col_no_bgcolor.row > div, .s_image_gallery .row > div"
11+
},
12+
{
13+
template: "mass_mailing.BorderOption",
14+
selector: ".o_mail_block_discount2",
15+
},
16+
],
17+
}
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { after, before, WIDTH } from "@html_builder/utils/option_sequence";
2+
import { Plugin } from "@html_editor/plugin";
3+
import { registry } from "@web/core/registry";
4+
import { withSequence } from "@html_editor/utils/resource";
5+
import { BorderConfigurator } from "@html_builder/plugins/border_configurator_option";
6+
7+
class ColumnOptionPlugin extends Plugin {
8+
static id = "columnPlugin";
9+
selector = ".col-lg";
10+
resources = {
11+
mark_color_level_selector_params: [{ selector: this.selector }],
12+
builder_options: [
13+
{
14+
OptionComponent: BorderConfigurator,
15+
selector: this.selector,
16+
props: {
17+
label: "Border"
18+
}
19+
}
20+
],
21+
};
22+
}
23+
// TODO: as in master, the position of a background image does not work
24+
// correctly.
25+
registry.category("builder-plugins").add(ColumnOptionPlugin.id, ColumnOptionPlugin);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { Plugin } from "@html_editor/plugin";
2+
import { registry } from "@web/core/registry";
3+
4+
class DropzonePlugin extends Plugin {
5+
static id = "mass_mailing.DropzonePlugin";
6+
7+
resources = {
8+
dropzone_selector: [
9+
{
10+
selector: ".o_mail_snippet_general",
11+
dropIn: ":not(p).oe_structure:not(.oe_structure_solo), :not(.o_mega_menu):not(p)[data-oe-type=html], :not(p).oe_structure.oe_structure_solo:not(:has(> section, > div))"
12+
}, {
13+
selector: ".s_mail_blockquote, .s_mail_alert, .s_rating, .s_hr, .s_mail_text_highlight",
14+
dropNear: "p, h1, h2, h3, ul, ol, .row > div > img, .s_mail_blockquote, .s_mail_alert, .s_rating, .s_hr, .s_mail_text_highlight",
15+
dropIn: ".content, nav",
16+
}, { // table_column
17+
selector: ".col>td, .col>th",
18+
exclude: this.noOptionsSelector,
19+
dropNear: ".col>td, .col>th",
20+
}, { // table_column_mv
21+
selector: ".col_mv, td, th",
22+
exclude: this.noOptionsSelector,
23+
dropNear: ".col_mv, td, th"
24+
}, { // table_row
25+
selector: "tr:has(> .row), tr:has(> .col_mv)",
26+
exclude: this.noOptionsSelector,
27+
dropNear: "tr:has(> .row), tr:has(> .col_mv)",
28+
}, { // content
29+
selector: ".note-editable > div:not(.o_layout), .note-editable .oe_structure > div, .oe_snippet_body",
30+
exclude: this.noOptionsSelector,
31+
dropNear: "[data-oe-field='body_html']:not(:has(.o_layout)) > *, .oe_structure > *",
32+
dropIn: "[data-oe-field='body_html']:not(:has(.o_layout)), .oe_structure",
33+
}, { // sizing_x
34+
selector: ".row > div",
35+
exclude: ".o_mail_no_resize, .o_mail_no_options, .s_col_no_resize.row > div, .s_col_no_resize",
36+
dropNear: ".row:not(.s_col_no_resize) > div",
37+
}
38+
]
39+
}
40+
41+
get noOptionsSelector() {
42+
return ".o_mail_no_options";
43+
}
44+
}
45+
46+
registry.category("builder-plugins").add(DropzonePlugin.id, DropzonePlugin);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { after, before, WIDTH } from "@html_builder/utils/option_sequence";
2+
import { Plugin } from "@html_editor/plugin";
3+
import { registry } from "@web/core/registry";
4+
import { withSequence } from "@html_editor/utils/resource";
5+
import { LayoutColumnOption } from "@html_builder/plugins/layout_column_option";
6+
7+
class GenericBlockOptionPlugin extends Plugin {
8+
static id = "GenericBlockOption";
9+
colorPickerSelector = `.note-editable .oe_structure > div:not(:has(> .o_mail_snippet_general)),
10+
.note-editable .oe_structure > div.o_mail_snippet_general,
11+
.note-editable .oe_structure > div.o_mail_snippet_general .o_cc,
12+
.s_mail_color_blocks_2 .row > div`;
13+
resources = {
14+
mark_color_level_selector_params: [{ selector: ".o_mail_snippet_general" }],
15+
builder_options: [
16+
withSequence(before(WIDTH), {
17+
OptionComponent: LayoutColumnOption,
18+
selector: ".o_mail_snippet_general",
19+
applyTo: "* > *:has(> .row:not(.s_nb_column_fixed)), * > .s_allow_columns"
20+
}),
21+
{
22+
template: "mass_mailing.BlockquoteOption",
23+
selector: ".o_mail_snippet_general",
24+
exclude: ".o_mail_snippet_general .row > div *"
25+
},
26+
{
27+
template: "mass_mailing.ColorPickerOption",
28+
selector: this.colorPickerSelector,
29+
exclude: ".o_mail_no_colorpicker, .o_mail_no_options, .s_mail_color_blocks_2"
30+
},
31+
],
32+
so_snippet_addition_selector: [".o_mail_snippet_general"],
33+
so_content_addition_selector: [
34+
".s_mail_blockquote, .s_mail_alert, .s_rating, .s_hr, .s_mail_text_highlight"
35+
]
36+
};
37+
}
38+
// TODO: as in master, the position of a background image does not work
39+
// correctly.
40+
registry.category("builder-plugins").add(GenericBlockOptionPlugin.id, GenericBlockOptionPlugin );

addons/mass_mailing_egg/static/src/builder/plugins/blockquote_option_plugin.js renamed to addons/mass_mailing_egg/static/src/builder/plugins/horizontal_padding_option_plugin.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,21 @@ import { after, before, WIDTH } from "@html_builder/utils/option_sequence";
22
import { Plugin } from "@html_editor/plugin";
33
import { registry } from "@web/core/registry";
44
import { withSequence } from "@html_editor/utils/resource";
5-
import { LayoutColumnOption } from "@html_builder/plugins/layout_column_option";
65

7-
class BlockquoteOptionPlugin extends Plugin {
8-
static id = "massMailingBlockquoteOption";
9-
selector = ".s_blockquote";
6+
class HorizontalPaddingOptionPlugin extends Plugin {
7+
static id = "horizontalPaddingOption";
8+
selector = "[class*='col-lg-'], .s_discount2, .s_text_block, .s_media_list, .s_picture, .s_rating";
109
resources = {
1110
mark_color_level_selector_params: [{ selector: this.selector }],
1211
builder_options: [
13-
withSequence(before(WIDTH), {
14-
OptionComponent: LayoutColumnOption,
15-
selector: this.selector,
16-
}),
1712
withSequence(after(WIDTH)), {
18-
template: "mass_mailing.BlockquoteOption",
13+
template: "mass_mailing.PaddingOption",
1914
selector: this.selector,
15+
exclude: ".s_col_no_resize.row > div, .s_col_no_resize",
2016
},
2117
],
2218
};
2319
}
2420
// TODO: as in master, the position of a background image does not work
2521
// correctly.
26-
registry.category("builder-plugins").add(BlockquoteOptionPlugin.id, BlockquoteOptionPlugin);
22+
registry.category("builder-plugins").add(HorizontalPaddingOptionPlugin.id, HorizontalPaddingOptionPlugin );

0 commit comments

Comments
 (0)