Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master snippet options owl agau #3305

Draft
wants to merge 128 commits into
base: master-snippet-options-owl-ard
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
5fb5de8
[REF] web_editor: move SnippetOptionWidget into legacy file
detrouxdev Apr 8, 2024
0b4d6d1
[REF] web_editor: convert SnippetOption widget to an ES6 class
detrouxdev Apr 8, 2024
661d5fd
[REF] web_editor: convert UserValueWidget and <we-button> to OWL
detrouxdev Apr 24, 2024
0369fbf
[REF] web_editor: convert <we-select> to OWL
detrouxdev Apr 24, 2024
6102422
[REF] web_editor: add WeButtonGroup component
detrouxdev May 8, 2024
bac3ebc
[WIP] web_editor: add tooltips on buttons
detrouxdev May 8, 2024
fdfd1b3
[REF] web_editor: Convert column width to new Owl option
detrouxdev May 8, 2024
66c96fb
[REF] web_editor: adapt Unit & Input user value widget to Owl
bso-odoo Apr 26, 2024
259a370
[REF] web_editor: convert we-datetimepicker to OWL
bso-odoo May 15, 2024
b0b52aa
[REF] web_editor: convert we-row to OWL
detrouxdev May 16, 2024
835e581
[REF] web_editor: add WeTitle component
robinlej Aug 1, 2024
6f5a802
[REF] web_editor, website: convert column and grid option to OWL
detrouxdev May 21, 2024
91a43b2
[REF] web_editor: convert ColorpickerUserValueWidget to OWL
detrouxdev Jun 4, 2024
bdf273b
[WIP] web_editor: convert Mediapicker widget to OWL
robinlej May 7, 2024
66577ca
[IMP] web_editor: convert Range widget to Owl
bso-odoo May 2, 2024
cc85af4
[IMP] website: convert UrlPicker widget to Owl
bso-odoo May 6, 2024
99a9593
[REF] web_editor: convert we-checkbox to Owl
bso-odoo Jun 3, 2024
476a963
[REF] website: convert SnippetOption website patch
bso-odoo Jun 4, 2024
57e093d
[REF] web_editor: convert MultiUserValueWidget to Owl
bso-odoo Jun 10, 2024
7c9cf16
[REF] website: convert s_facebook_page options to Owl
agau-odoo Jun 20, 2024
a475943
[REF] website: convert s_image options to Owl
agau-odoo Jun 20, 2024
160ee60
[REF] web_editor: allow asynchronous start on UserValue
bso-odoo Jun 5, 2024
4ee4096
[REF] website: convert GPSPicker to Owl
bso-odoo May 29, 2024
d674f9f
[REF] website: convert s_google_map options
bso-odoo Jun 3, 2024
390b007
[REF] convert WeFontFamilyPicker to Owl
bso-odoo Jun 6, 2024
e4de5f1
[REF] website: convert s_instagram_page options to Owl
agau-odoo Jun 20, 2024
bac452b
[REF] website: convert s_map options to Owl
agau-odoo Jun 20, 2024
94371df
[MOV] web: move camelToKebab to strings utils
robinlej Jun 25, 2024
65dcedf
[REF] web_editor: convert ListUserValueWidget to OWL
robinlej May 27, 2024
8c0f4bb
[REF] web_editor: show widget components by default
robinlej Jun 11, 2024
84c5aff
[REF] web_editor, website: convert Many2oneUserValueWidget to OWL
robinlej Jun 7, 2024
46267d8
[REF] website: convert s_embed_code options to OWL
robinlej Jun 20, 2024
3216ca6
[REF] web_editor: convert "cover_update" trigger_up
robinlej Jun 25, 2024
1bd3554
[REF] (temp) website: use env in utils instead of trigger_up
robinlej Jun 26, 2024
548fde5
[REF] web_editor: convert option_update trigger_up to notifyOptions
robinlej Jun 28, 2024
5dea23a
[REF] web_editor, *: introduce a register mechanism for options
detrouxdev Jul 3, 2024
b1918da
[REF] web_editor, website: adapt background options to OWL
detrouxdev Jul 3, 2024
389c3e5
[REF] web_editor: add isElementSelected to subEnv
robinlej Jun 28, 2024
124c26f
[REF] website: convert s_blockquote options to Owl
bso-odoo Jul 4, 2024
1707933
[REF] website: convert vertical alignment option
bso-odoo Jun 12, 2024
f788525
[REF] website: convert card color/border/shadow options to Owl
bso-odoo Jun 13, 2024
e80997f
[REF] website: convert horizontal alignment options to Owl
bso-odoo Jun 13, 2024
86e26be
[REF] website: convert share/social option to Owl
bso-odoo Jun 13, 2024
831a1b9
[FIX] web_editor: delay OWL updateUI until after postSnippetDrop promise
detrouxdev Jul 5, 2024
540db97
[FIX] web_editor, website: fix tours with OWL options
detrouxdev Jul 8, 2024
3ea0730
[REF] website: remove old exports
detrouxdev Jul 8, 2024
8322e5b
[WIP][FIX] website: attempt to fix a tour
detrouxdev Jul 8, 2024
4fe4219
[WIP] web_editor: attempt at improving performance of tours
detrouxdev Jul 10, 2024
c32cdbb
[REF] website: convert s_countdown options to Owl
bso-odoo Jun 18, 2024
c67ce1c
[REF] website: convert s_media_list options to Owl
bso-odoo Jun 27, 2024
37f13b4
[REF] website: add only coulumn option
detrouxdev Jul 11, 2024
5c07f5b
[REF] website: convert s_process_steps options to Owl
bso-odoo Jun 27, 2024
725772e
[REF] website: convert GalleryImage options to OWL
robinlej Jun 25, 2024
f8ec375
[IMP] web_editor: add static defaultRenderingComponent to SnippetOpti…
agau-odoo Jun 27, 2024
cda4955
[REF] web_editor: add updateSnippetOptionVisibility to SnippetEditor …
robinlej Jun 28, 2024
b9bbaa3
[REF] website, web_editor: convert DeviceVisibility and ConditionalVi…
robinlej Jun 28, 2024
ebdd8f4
[REF] web_editor, *: refactor serviceCached to work with any services
detrouxdev Jul 16, 2024
c813146
[REF] website: convert SocialMedia options to OWL
robinlej Jul 1, 2024
397c6a2
[REF] website_sale: convert s_add_to_cart option to OWL
robinlej Jul 2, 2024
965d15a
[REF] website_mail_group: convert s_group options to OWL
robinlej Jul 3, 2024
97647a2
[REF] web_editor: hide editors for users not in group
robinlej Jul 4, 2024
595f445
[REF] web_editor: provide a way to display Owl options in overlay
bso-odoo Jun 27, 2024
351efbd
[REF] web_editor, website: convert SnippetMove options to Owl
bso-odoo Jun 27, 2024
08b7c1d
[REF] website: convert s_product_catalog options to Owl
bso-odoo Jun 27, 2024
f2c9ae6
[REF] website: convert s_progress_bar option to Owl
bso-odoo Jul 1, 2024
14d19b0
[REF] web_editor, website: convert s_chart to Owl
bso-odoo Jun 12, 2024
6b0b66d
[REF] website, *: convert dynamic snippet options to Owl
bso-odoo Jun 18, 2024
32b7ee6
[REM] website: s_progress_bar already in so_content_addition
bso-odoo Jul 1, 2024
7ef0f30
[REF] website: convert s_showcase option to Owl
bso-odoo Jul 1, 2024
d8c42ef
[REF] web_editor: support isTopOption in Owl snippet options
bso-odoo Jul 1, 2024
a177a10
[REF] website: convert s_tabs option to Owl
bso-odoo Jul 1, 2024
e832d2d
[REF] website: convert s_timeline option to Owl
bso-odoo Jul 1, 2024
b0a048a
[REF] web_editor: support naming editor block with data.string
bso-odoo Jul 2, 2024
dec2389
[REF] website: convert s_website_controller_page_listing to Owl
bso-odoo Jul 1, 2024
a094064
[REF] website, web_editor: Carousel, CarouselItem, GalleryElement
robinlej Jul 5, 2024
c9150b9
[REF] web_editor: convert SelectTemplate option to Owl
agau-odoo Jun 26, 2024
b5098a2
[REF] web_editor: convert s_masonry_block options to Owl
agau-odoo Jun 26, 2024
6e5a9ff
[IMP] web_editor: use forceNoDeleteButton in owl options
agau-odoo Jul 1, 2024
cf14b7b
[REF] web_editor, website: convert MegaMenuLayout options to owl
agau-odoo Jun 26, 2024
554bae5
[WIP] web_editor: disable test_options
detrouxdev Jul 23, 2024
5beda1a
[REF] website_payment, *: convert s_donation options to OWL
robinlej Jul 3, 2024
b7dab7d
[REF] website: convert s_rating option to Owl
bso-odoo Jul 1, 2024
67342bd
[REF] web_editor, website: convert s_website_form options to Owl
bso-odoo Jul 2, 2024
0565709
[WIP] disable legacy options and keep editors in DOM
detrouxdev Aug 6, 2024
1ea9cc1
[WIP] fixup! [REF] web_editor, website: convert s_website_form option…
detrouxdev Aug 6, 2024
de9a637
[REF] mass_mailing: convert s_masonry_block options to owl
agau-odoo Jun 27, 2024
6042938
fixup [REF] website: convert s_google_map options
agau-odoo Jun 28, 2024
9caa133
[REF] web_editor, website, *: convert anchor options to owl
agau-odoo Jun 28, 2024
2fa2393
[FIX] website_blog: hide container_width options for blog posts conte…
agau-odoo Jul 2, 2024
f2c6a27
[FIX] website_mass_mailing: malformed selector?
agau-odoo Jul 18, 2024
5e94689
[FIX] website: MegaMenuNoDeleteDrop dropNear
agau-odoo Jul 18, 2024
8aaaead
[REF] website: add getPageOption and togglePageOption to wysiwyg
agau-odoo Jul 19, 2024
190e80b
[REF] website: convert TopMenuColor options to owl
agau-odoo Jul 23, 2024
7f3e9c6
[REF] website: convert TopMenuVisibility and HideFooter options to owl
agau-odoo Jul 24, 2024
9887779
fixup [REF] web_editor: convert <we-select> to OWL
agau-odoo Jul 24, 2024
ead116d
fixup [REF] web_editor: convert s_masonry_block options to Owl
agau-odoo Jul 25, 2024
10c548a
[REF] website: convert s_popup and CookieBar options to owl
agau-odoo Jun 28, 2024
330496b
wip fixup? [FIX] website: fix reload_bundles
agau-odoo Jul 24, 2024
6ce1f14
[REF] website: convert HeaderNavbar options to owl
agau-odoo Jul 24, 2024
b245fff
[REF] website: convert HeaderElements options to owl
agau-odoo Jul 25, 2024
b2d82b7
[REF] web_editor: port animate image on preview to owl
agau-odoo Jul 25, 2024
617bd2c
[REF] website: convert header-scroll-effect options to owl
agau-odoo Jul 25, 2024
58b8898
[REF] website: convert header_language_selector options to owl
agau-odoo Jul 25, 2024
1c3f7e4
[REF] website: convert option_header_brand_* options to owl
agau-odoo Jul 25, 2024
b03620f
[REF] website: convert footer-scrolltop options to owl
agau-odoo Jul 25, 2024
286e51e
[REF] website: convert special page "Odoo Information" options to owl
agau-odoo Jul 25, 2024
cbdd3a2
[REF] website: convert wysiwyg menu trigger ups to public method
agau-odoo Jul 25, 2024
6fecbd7
[REF] website: convert menu_data overlay to owl
agau-odoo Jul 25, 2024
aca7e86
[REF] website: convert HeaderBox options to owl
agau-odoo Jul 25, 2024
ffd22d1
[REF] mass_mailing: only show mass_mailing and web_editor options
agau-odoo Jul 26, 2024
8934709
fixup [REF] mass_mailing: convert s_masonry_block options to owl
agau-odoo Jul 26, 2024
eda0d98
[REF] mass_mailing: convert s_rating options to owl
agau-odoo Jul 26, 2024
b4a2126
[REF] mass_mailing: convert s_showcase options to owl
agau-odoo Jul 29, 2024
090d43a
[REF] web_editor: convert special drop in selectors options* to owl
agau-odoo Jul 30, 2024
ebc18f0
[REF] website_mass_mailing: convert newsletter snippets* options to Owl
agau-odoo Jun 26, 2024
8ab1c4f
[REF] website, *: convert s_searchbar options to owl
agau-odoo Jul 3, 2024
ae99a2f
fixup [REF] web_editor, website: convert s_website_form options to Owl
agau-odoo Jul 30, 2024
d914d88
[REF] website: convert s_speaker_bio options to owl
agau-odoo Jul 30, 2024
4a4d111
[REF] mass_mailing, website: remove now-unused special drop in options
agau-odoo Jul 30, 2024
a33163a
[REF] mass_mailing: convert s_media_list options to owl
agau-odoo Jul 31, 2024
f40ca0d
[REF] website_sale: convert page options* to owl
agau-odoo Aug 1, 2024
908923b
[REF] website: convert so_width common options to owl
agau-odoo Aug 9, 2024
32e1971
[REF] website: convert s_alert options to owl
agau-odoo Aug 9, 2024
b74f017
[REF] website: convert so_block_align option to owl
agau-odoo Aug 12, 2024
f92f79a
[REF] mass_mailing: convert border options to OWL
robinlej Jul 31, 2024
144625f
fixup [REF] mass_mailing: convert border options to OWL
agau-odoo Aug 12, 2024
fee4787
[REF] mass_mailing: convert so_block_align option to owl
agau-odoo Aug 12, 2024
08a92b4
[REF] mass_mailing: convert so_block and s_alert options to owl
agau-odoo Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions addons/mass_mailing/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,19 @@
],
'mass_mailing.assets_wysiwyg': [
'mass_mailing/static/src/js/mass_mailing_snippets.js',
'mass_mailing/static/src/js/snippets.options.xml',
'mass_mailing/static/src/snippets/s_alert/options.js',
'mass_mailing/static/src/snippets/s_alert/options.xml',
'mass_mailing/static/src/snippets/s_masonry_block/options.js',
'mass_mailing/static/src/snippets/s_masonry_block/options.xml',
'mass_mailing/static/src/snippets/s_media_list/options.js',
'mass_mailing/static/src/snippets/s_showcase/options.js',
'mass_mailing/static/src/snippets/s_rating/options.js'
],
'mass_mailing.assets_snippets_menu': [
('include', 'web_editor.assets_snippets_menu'),
'mass_mailing/static/src/js/snippets.editor.js',
'mass_mailing/static/src/js/snippets.registry.js',
'mass_mailing/static/src/xml/mass_mailing.editor.xml',
],
'web.assets_frontend': [
Expand All @@ -171,6 +176,7 @@
'mass_mailing/static/src/snippets/s_media_list/options.js',
'mass_mailing/static/src/snippets/s_showcase/options.js',
'mass_mailing/static/src/snippets/s_rating/options.js',
'mass_mailing/static/src/snippets/s_rating/options.xml',
'mass_mailing/static/tests/mass_mailing_html_tests.js',
],
},
Expand Down
16 changes: 15 additions & 1 deletion addons/mass_mailing/static/src/js/mass_mailing_snippets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @odoo-module **/

import options from "@web_editor/js/editor/snippets.options";
import options from "@web_editor/js/editor/snippets.options.legacy";
import { loadImage } from "@web_editor/js/editor/image_processing";
import { registerSnippetAdditionSelector } from "@web_editor/js/editor/snippets.registry";
const SelectUserValueWidget = options.userValueWidgetsRegistry['we-select'];
import weUtils from "@web_editor/js/common/utils";
import {
Expand All @@ -11,12 +12,15 @@ import {
transformFontFamilySelector,
} from "@mass_mailing/js/mass_mailing_design_constants";
import { isCSSColor, normalizeCSSColor } from "@web/core/utils/colors";
import { registerMassMailingOption } from "./snippets.registry";


//--------------------------------------------------------------------------
// Options
//--------------------------------------------------------------------------

registerSnippetAdditionSelector(".o_mail_snippet_general");

// Adding compatibility for the outlook compliance of mailings.
// Commit of such compatibility : a14f89c8663c9cafecb1cc26918055e023ecbe42
options.registry.MassMailingBackgroundImage = options.registry.BackgroundImage.extend({
Expand Down Expand Up @@ -322,3 +326,13 @@ options.registry.DesignTab = options.Class.extend({
return [...(this.styleSheet.cssRules || this.styleSheet.rules)].find(rule => rule.selectorText === selectorText);
},
});

registerMassMailingOption("mass_mailing_block_width", {
template: "mass_mailing.block_width_option",
selector: ".s_mail_blockquote, .s_mail_text_highlight",
});

registerMassMailingOption("mass_mailing_block_align", {
template: "mass_mailing.block_align_option",
selector: ".s_mail_blockquote, .s_mail_text_highlight",
});
9 changes: 9 additions & 0 deletions addons/mass_mailing/static/src/js/snippets.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ export class MassMailingSnippetsMenu extends snippetsEditor.SnippetsMenu {
html.querySelectorAll('img').forEach(img => img.setAttribute("loading", "lazy"));
return super._computeSnippetTemplates(html);
}
/**
* @override
*/
getOptions() {
const options = super.getOptions().filter(([, option]) => {
return ["mass_mailing", "web_editor"].includes(option.module);
});
return options;
}
/**
* @override
*/
Expand Down
62 changes: 62 additions & 0 deletions addons/mass_mailing/static/src/js/snippets.options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="mass_mailing.block_width_option">
<WeSelect title.translate="Width">
<WeButton selectClass="'w-25'">25%</WeButton>
<WeButton selectClass="'w-50'">50%</WeButton>
<WeButton selectClass="'w-75'">75%</WeButton>
<WeButton selectClass="'w-100'" name="'so_width_100'">100%</WeButton>
</WeSelect>
</t>

<t t-name="mass_mailing.block_align_option">
<WeButtonGroup title.translate="Alignment" dependencies="'!so_width_100'">
<WeButton class="'fa fa-fw fa-align-left'" tooltip.translate="Left" selectClass="'me-auto'"/>
<WeButton class="'fa fa-fw fa-align-center'" tooltip.translate="Center" selectClass="'mx-auto'"/>
<WeButton class="'fa fa-fw fa-align-right'" tooltip.translate="Right" selectClass="'ms-auto'"/>
</WeButtonGroup>
</t>

<!-- Border -->
<t t-name="mass_mailing.snippet_options_border_line_widgets">
<WeRow title="label">
<WeInput name="'border_width_opt'"
applyTo="apply_to || ''"
selectStyle="'0'"
cssProperty="'border-' + (direction ? direction + '-' : '') + 'width'"
unit="'px'"
extraClass="with_bs_class ? 'border' : ''"
variable="width_variable || ''"/>
<WeSelect dependencies="'border_width_opt'"
cssProperty="'border-' + (direction ? direction + '-' : '') + 'style'"
applyTo="apply_to || ''"
variable="style_variable || ''">
<WeButton tooltip.translate="Solid" selectStyle="'solid'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: solid;"/></WeButton>
<WeButton tooltip.translate="Dashed" selectStyle="'dashed'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: dashed;"/></WeButton>
<WeButton tooltip.translate="Dotted" selectStyle="'dotted'"><div class="o_we_fake_img_item o_we_border_preview" style="border-style: dotted;"/></WeButton>
<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>
</WeSelect>
<WeColorpicker dependencies="'border_width_opt'"
applyTo="apply_to || ''"
selectStyle="'true'"
cssProperty="'border-' + (direction ? direction + '-' : '') + 'color'"
colorPrefix="'border-'"
color="color_variable || ''"/>
</WeRow>
</t>

<t t-name="mass_mailing.snippet_options_border_widgets">
<t t-call="mass_mailing.snippet_options_border_line_widgets">
<t t-set="label">Border</t>
<t t-set="with_bs_class" t-value="true"/>
</t>
<WeInput title.translate="Round Corners"
applyTo="apply_to || ''"
dependencies="!so_rounded_no_dependencies and 'border_width_opt,bg_color_opt'"
selectStyle="'0'" cssProperty="'border-radius'"
unit="'px'" extraClass="'rounded'"
variable="radius_variable || ''"/>
</t>

</templates>
8 changes: 8 additions & 0 deletions addons/mass_mailing/static/src/js/snippets.registry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerOption } from "@web_editor/js/editor/snippets.registry";

export function registerMassMailingOption(name, def, options) {
if (!def.module) {
def.module = "mass_mailing";
}
return registerOption(name, def, options);
}
36 changes: 36 additions & 0 deletions addons/mass_mailing/static/src/snippets/s_alert/002.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.o_mail_snippet_general .s_mail_alert [class^="col-lg"]{
padding-left: 0!important;
padding-right: 0!important;
}

.s_mail_alert {
.s_alert {
border-width: $alert-border-width;
border-style: solid;
border-radius: $alert-border-radius;
p, ul, ol {
&:last-child {
margin-bottom: 0;
}
}
}
.s_alert_sm {
padding: $grid-gutter-width/3;
font-size: $font-size-sm;
}
.s_alert_md {
padding: $grid-gutter-width/2;
font-size: $font-size-base;
}
.s_alert_lg {
padding: $grid-gutter-width;
font-size: $font-size-lg;
}
.s_alert_icon {
float: left;
margin-right: 10px;
}
.s_alert_content {
overflow: hidden;
}
}
6 changes: 6 additions & 0 deletions addons/mass_mailing/static/src/snippets/s_alert/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { registerMassMailingOption } from "@mass_mailing/js/snippets.registry";

registerMassMailingOption("MassMailingAlert", {
template: "mass_mailing.s_alert_options",
selector: ".s_mail_alert .s_alert",
});
22 changes: 22 additions & 0 deletions addons/mass_mailing/static/src/snippets/s_alert/options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="mass_mailing.s_alert_options">
<t t-call="mass_mailing.block_width_option"/>
<WeSelect title.translate="Size">
<WeButton selectClass="'s_alert_sm'">Small</WeButton>
<WeButton selectClass="'s_alert_md'">Medium</WeButton>
<WeButton selectClass="'s_alert_lg'">Large</WeButton>
</WeSelect>
<WeColorpicker title.translate="Background Color"
name="'alert_colorpicker_opt'"
selectStyle="'true'"
cssProperty="'background-color'"
colorPrefix="'alert-'"/>
<t t-call="mass_mailing.snippet_options_border_widgets">
<t t-set="so_rounded_no_dependencies" t-value="True"/>
</t>
<t t-call="mass_mailing.block_align_option"/>
</t>

</templates>
24 changes: 14 additions & 10 deletions addons/mass_mailing/static/src/snippets/s_masonry_block/options.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
/** @odoo-module **/
import { SelectTemplate } from "@web_editor/js/editor/snippets.options";
import { registerMassMailingOption } from "@mass_mailing/js/snippets.registry";

import options from "@web_editor/js/editor/snippets.options";

options.registry.MasonryLayout = options.registry.SelectTemplate.extend({
/**
* @constructor
*/
init() {
this._super(...arguments);
export class MasonryLayout extends SelectTemplate {
constructor() {
super(...arguments);
this.containerSelector = '> .container, > .container-fluid, > .o_container_small';
this.selectTemplateWidgetName = 'masonry_template_opt';
},
}
}

registerMassMailingOption("MassMailingMasonryLayout", {
Class: MasonryLayout,
template: "mass_mailing.s_masonry_block_options",
selector: ".s_masonry_block",
}, {
sequence: 10,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="mass_mailing.s_masonry_block_options" inherit_id="mass_mailing.snippet_options">
<WeSelect title.translate="Template"
name="'masonry_template_opt'"
attributeName="'masonryTemplate'"
attributeDefaultValue="'default'">
<WeButton tooltip.translate="Default"
selectTemplate="'mass_mailing.s_masonry_block_default_template'"
selectDataAttribute="'default'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_default.svg'"/>
<WeButton tooltip.translate="Default Reversed"
selectTemplate="'mass_mailing.s_masonry_block_reversed_template'"
selectDataAttribute="'default_reversed'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_reversed.svg'"/>
<WeButton tooltip.translate="Images"
selectTemplate="'mass_mailing.s_masonry_block_images_template'"
selectDataAttribute="'images'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_images.svg'"/>
<WeButton tooltip.translate="Image Text Image"
selectTemplate="'mass_mailing.s_masonry_block_image_texts_image_template'"
selectDataAttribute="'image_text_image'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_image_texts_image.svg'"/>
<WeButton tooltip.translate="Mosaic"
selectTemplate="'mass_mailing.s_masonry_block_mosaic_template'"
selectDataAttribute="'mosaic'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_mosaic.svg'"/>
<WeButton tooltip.translate="Text Image Text"
selectTemplate="'mass_mailing.s_masonry_block_texts_image_texts_template'"
selectDataAttribute="'text_image_text'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_texts_image_texts.svg'"/>
<WeButton tooltip.translate="Alternate Text"
selectTemplate="'mass_mailing.s_masonry_block_alternation_text_template'"
selectDataAttribute="'alternate_text'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_alternate_texts.svg'"/>
<WeButton tooltip.translate="Alternate Text Image"
selectTemplate="'mass_mailing.s_masonry_block_alternation_text_image_template'"
selectDataAttribute="'alternate_text_image'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_alternate_text_image.svg'"/>
<WeButton tooltip.translate="Alternate Image Text"
selectTemplate="'mass_mailing.s_masonry_block_alternation_image_text_template'"
selectDataAttribute="'alternate_image_text'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_alternate_image_text.svg'"/>
<WeButton tooltip.translate="Alternate Text Image Text"
selectTemplate="'mass_mailing.s_masonry_block_alternation_text_image_text_template'"
selectDataAttribute="'alternate_text_image_text'"
img="'/mass_mailing/static/src/img/snippets_options/masonry_template_alternate_text_image_text.svg'"/>
</WeSelect>
</t>

</templates>
21 changes: 11 additions & 10 deletions addons/mass_mailing/static/src/snippets/s_media_list/options.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/** @odoo-module **/
import { SnippetOption } from "@web_editor/js/editor/snippets.options";

import options from "@web_editor/js/editor/snippets.options";

options.registry.MediaItemLayout = options.Class.extend({
// FIXME: this is unused (no option definition in mass_mailing),
// see addons/website/static/src/snippets/s_media_list/options.js
// This is never attached to any snippet (no selector).
export class MediaItemLayout extends SnippetOption {

//--------------------------------------------------------------------------
// Options
Expand All @@ -13,7 +14,7 @@ options.registry.MediaItemLayout = options.Class.extend({
*
* @see this.selectClass for parameters
*/
layout: function (previewMode, widgetValue, params) {
layout(previewMode, widgetValue, params) {
const $image = this.$target.find('.s_media_list_img_wrapper');
const $content = this.$target.find('.s_media_list_body');

Expand All @@ -23,7 +24,7 @@ options.registry.MediaItemLayout = options.Class.extend({
}
$image.addClass(`col-lg-${widgetValue}`);
$content.addClass(`col-lg-${12 - widgetValue}`);
},
}

//--------------------------------------------------------------------------
// Private
Expand All @@ -32,7 +33,7 @@ options.registry.MediaItemLayout = options.Class.extend({
/**
* @override
*/
_computeWidgetState(methodName, params) {
async _computeWidgetState(methodName, params) {
switch (methodName) {
case 'layout': {
const $image = this.$target.find('.s_media_list_img_wrapper');
Expand All @@ -43,6 +44,6 @@ options.registry.MediaItemLayout = options.Class.extend({
}
}
}
return this._super(...arguments);
},
});
return super._computeWidgetState(...arguments);
}
}
Loading