Skip to content

Commit f92f79a

Browse files
robinlejagau-odoo
authored andcommitted
[REF] mass_mailing: convert border options to OWL
task-3850413
1 parent b74f017 commit f92f79a

File tree

5 files changed

+69
-48
lines changed

5 files changed

+69
-48
lines changed

addons/mass_mailing/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
'mass_mailing/static/src/js/snippets.editor.js',
161161
'mass_mailing/static/src/js/snippets.registry.js',
162162
'mass_mailing/static/src/xml/mass_mailing.editor.xml',
163+
'mass_mailing/static/src/js/snippets.options.xml',
163164
],
164165
'web.assets_frontend': [
165166
'mass_mailing/static/src/js/tours/**/*',
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<templates id="template" xml:space="preserve">
3+
4+
<!-- Border -->
5+
<t t-name="mass_mailing.snippet_options_border_line_widgets">
6+
<WeRow title="label">
7+
<WeInput name="'border_width_opt'"
8+
applyTo="apply_to || ''"
9+
selectStyle="'0'"
10+
cssProperty="'border-' + (direction ? direction + '-' : '') + 'width'"
11+
unit="'px'"
12+
extraClass="with_bs_class ? 'border' : ''"
13+
variable="width_variable || ''"/>
14+
<WeSelect dependencies="'border_width_opt'"
15+
cssProperty="'border-' + (direction ? direction + '-' : '') + 'style'"
16+
applyTo="apply_to || ''"
17+
variable="style_variable || ''">
18+
<WeButton tooltip.translate="Solid" selectStyle="'solid'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: solid;"/></WeButton>
19+
<WeButton tooltip.translate="Dashed" selectStyle="'dashed'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: dashed;"/></WeButton>
20+
<WeButton tooltip.translate="Dotted" selectStyle="'dotted'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: dotted;"/></WeButton>
21+
<WeButton tooltip.translate="Double" selectStyle="'double'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: double; border-left: none; border-right: none;"/></WeButton>
22+
</WeSelect>
23+
<WeColorpicker dependencies="'border_width_opt'"
24+
applyTo="apply_to || ''"
25+
selectStyle="'true'"
26+
cssProperty="'border-' + (direction ? direction + '-' : '') + 'color'"
27+
colorPrefix="'border-'"
28+
color="color_variable || ''"/>
29+
</WeRow>
30+
</t>
31+
32+
<t t-name="mass_mailing.snippet_options_border_widgets">
33+
<t t-call="mass_mailing.snippet_options_border_line_widgets">
34+
<t t-set="label">Border</t>
35+
<t t-set="with_bs_class" t-value="true"/>
36+
</t>
37+
<WeInput title.translate="Round Corners"
38+
applyTo="apply_to || ''"
39+
dependencies="!so_rounded_no_dependencies and 'border_width_opt,bg_color_opt'"
40+
selectStyle="'0'" cssProperty="'border-radius'"
41+
unit="'px'" extraClass="'rounded'"
42+
variable="radius_variable || ''"/>
43+
</t>
44+
45+
</templates>

addons/mass_mailing/views/snippets/s_alert.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@
3535
data-color-prefix="alert-"/>
3636
</div>
3737
<div data-selector=".s_mail_alert .s_alert">
38-
<t t-call="mass_mailing.snippet_options_border_widgets">
38+
<!-- TODO @owl-options: do convert & uncomment this. Just commented
39+
in legacy to avoid errors. -->
40+
<!-- <t t-call="mass_mailing.snippet_options_border_widgets">
3941
<t t-set="so_rounded_no_dependencies" t-value="True"/>
40-
</t>
42+
</t> -->
4143
</div>
4244
</xpath>
4345
</template>

addons/mass_mailing/views/snippets/s_hr.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
<template id="s_hr_options" inherit_id="mass_mailing.snippet_options">
1414
<xpath expr="." position="inside">
1515
<div data-selector=".s_hr" data-target="hr">
16-
<t t-call="mass_mailing.snippet_options_border_line_widgets">
16+
<!-- TODO @owl-options: do convert & uncomment this. Just commented
17+
in legacy to avoid errors. -->
18+
<!-- <t t-call="mass_mailing.snippet_options_border_line_widgets">
1719
<t t-set="label">Border</t>
1820
<t t-set="direction" t-value="'top'"/>
19-
</t>
21+
</t> -->
2022
<we-select string="Width">
2123
<we-button data-select-class="w-25">25%</we-button>
2224
<we-button data-select-class="w-50">50%</we-button>

addons/mass_mailing/views/snippets_themes.xml

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -227,45 +227,10 @@
227227
</template>
228228

229229
<!-- Border -->
230-
<template id="snippet_options_border_line_widgets">
231-
<we-row t-att-string="label">
232-
<we-input data-name="border_width_opt"
233-
t-att-data-apply-to="apply_to"
234-
data-select-style="0"
235-
t-attf-data-css-property="border-#{direction and ('%s-' % direction) or ''}width"
236-
data-unit="px"
237-
t-att-data-extra-class="with_bs_class and 'border'"
238-
t-att-data-variable="width_variable"/>
239-
<we-select t-attf-data-css-property="border-#{direction and ('%s-' % direction) or ''}style"
240-
data-dependencies="border_width_opt"
241-
t-att-data-apply-to="apply_to"
242-
t-att-data-variable="style_variable">
243-
<we-button title="Solid" data-select-style="solid"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: solid;"/></we-button>
244-
<we-button title="Dashed" data-select-style="dashed"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: dashed;"/></we-button>
245-
<we-button title="Dotted" data-select-style="dotted"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: dotted;"/></we-button>
246-
<we-button title="Double" data-select-style="double"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: double; border-left: none; border-right: none;"/></we-button>
247-
</we-select>
248-
<we-colorpicker data-dependencies="border_width_opt"
249-
t-att-data-apply-to="apply_to"
250-
data-select-style="true"
251-
t-attf-data-css-property="border-#{direction and ('%s-' % direction) or ''}color"
252-
data-color-prefix="border-"
253-
t-att-data-color="color_variable"/>
254-
</we-row>
255-
</template>
256-
257-
<template id="snippet_options_border_widgets">
258-
<t t-call="mass_mailing.snippet_options_border_line_widgets">
259-
<t t-set="label">Border</t>
260-
<t t-set="with_bs_class" t-value="True"/>
261-
</t>
262-
<we-input string="Round Corners"
263-
t-att-data-apply-to="apply_to"
264-
t-att-data-dependencies="not so_rounded_no_dependencies and 'border_width_opt,bg_color_opt'"
265-
data-select-style="0" data-css-property="border-radius"
266-
data-unit="px" data-extra-class="rounded"
267-
t-att-data-variable="radius_variable"/>
268-
</template>
230+
<!-- TODO @owl-options: remove snippet_options_border_line_widgets and
231+
snippet_options_border_widgets once everything is refactored. -->
232+
<!-- <template id="snippet_options_border_line_widgets"> -->
233+
<!-- <template id="snippet_options_border_widgets"> -->
269234

270235
<template id="snippet_options_background_options" inherit_id="web_editor.snippet_options_background_options" primary="True">
271236
<xpath expr="//div[@data-js='BackgroundImage']" position="attributes">
@@ -333,7 +298,9 @@
333298
<div data-js="Box"
334299
data-selector=".row > div"
335300
data-exclude=".o_mail_wrapper_td, .s_col_no_bgcolor, .s_col_no_bgcolor.row > div, .s_image_gallery .row > div">
336-
<t t-call="mass_mailing.snippet_options_border_widgets"/>
301+
<!-- TODO @owl-options: do convert & uncomment this. Just commented
302+
in legacy to avoid errors. -->
303+
<!-- <t t-call="mass_mailing.snippet_options_border_widgets"/> -->
337304
</div>
338305
<div data-js="layout_column"
339306
data-selector=".o_mail_snippet_general"
@@ -468,16 +435,20 @@
468435
<div data-js="Box"
469436
data-selector=".s_three_columns .row > div, .s_comparisons .row > div, .s_mail_block_event .row > div"
470437
data-target=".card">
471-
<t t-call="mass_mailing.snippet_options_border_widgets">
438+
<!-- TODO @owl-options: do convert & uncomment this. Just commented
439+
in legacy to avoid errors. -->
440+
<!-- <t t-call="mass_mailing.snippet_options_border_widgets">
472441
<t t-set="so_rounded_no_dependencies" t-value="True"/>
473-
</t>
442+
</t> -->
474443
</div>
475444
<!-- COLOR, BORDER | .o_mail_block_discount2 -->
476445
<div data-js="Box"
477446
data-selector=".o_mail_block_discount2"
478447
data-target="table">
479-
<t t-call="mass_mailing.snippet_options_border_widgets">
480-
</t>
448+
<!-- TODO @owl-options: do convert & uncomment this. Just commented
449+
in legacy to avoid errors. -->
450+
<!-- <t t-call="mass_mailing.snippet_options_border_widgets">
451+
</t> -->
481452
</div>
482453

483454
<!-- Vertical Alignment -->

0 commit comments

Comments
 (0)