[Mass Mailing] Plain text template, disable the snippets

Make plain text mode more user-friendly and behave like gmail

* No snippet bar for plain text template
* once the plain text template selected, the cursor should be in the mail or
add a placeholder
* Default Unsubscribe link in the plain text template
* Don't force the font type; Let each email client use its own default font.

opw-1852811
This commit is contained in:
Christophe Matthieu
2018-08-13 12:24:37 +02:00
5 changed files with 37 additions and 0 deletions
@@ -0,0 +1,7 @@
/* We want to show system's default font in the mail sent with the basic theme.
And so we remove font-family from basic theme while saving. But by doing so
in readonly mode is not getting proper font in odoo. So we added if from here.
*/
#wrapwrap .o_layout.o_basic_theme {
font-family: -apple-system, "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
@@ -362,10 +362,21 @@ snippets_editor.Class.include({
if (first_choice) {
self._registerDefaultTexts($new_wrapper_content);
if(theme_params.name == 'basic') {
$editable_area.focusIn();
}
}
self._disableUndroppableSnippets();
}
},
cleanForSave: function () {
this._super.apply(this, arguments);
// remove font-family from all elements for plain text theme (just like gmail)
var $basicTheme = this.$editable.find('.o_basic_theme');
if($basicTheme.length && this.$editable.data('oe-model') === 'mail.mass_mailing') {
this.$editable.find('*').css('font-family', '');
}
}
});
var callback = window ? window["callback"] : undefined;
@@ -41,6 +41,9 @@
.dropdown-item {
padding: 10px 10px;
&:first-child {
display: none;
}
.o_thumb {
display: none;
@@ -91,6 +94,10 @@ body.o_force_mail_theme_choice {
max-width: 25%;
transition: all 0.3s ease 0s;
&:first-child {
display: block;
}
.o_thumb {
display: none;
padding-top: 107%;
@@ -153,6 +160,12 @@ body.o_force_mail_theme_choice {
}
#web_editor_inside_iframe {
&.o_basic_theme {
padding-left: 0px !important;
#oe_snippets {
display: none;
}
}
#wrapwrap > main #editable_area {
padding: 24px;
}
@@ -13,6 +13,9 @@
<t t-call-assets="mass_mailing.assets_mail_themes"/>
<script type="text/javascript" src="/mass_mailing/static/src/js/mass_mailing_editor.js"></script>
</t>
<t t-else="">
<link rel="stylesheet" href="/mass_mailing/static/src/css/basic_theme_readonly.css" type="text/css"/>
</t>
<base target="_parent"/>
</t>
<t t-set="head" t-value="head_mm_field_text_html_inline + (head or '')"/>
@@ -3,8 +3,11 @@
<!-- Theme "Basic" template -->
<template id="theme_basic_template">
<div class="o_mail_no_options">
<p><br/></p>
<p><br/></p>
<p>
<br/>
<a href="/unsubscribe_from_list">Unsubscribe</a>
</p>
</div>
</template>