From 7f0cc6ac527cc3251ad1c1086e3302d589de0c20 Mon Sep 17 00:00:00 2001 From: Anshuman Sharma Date: Wed, 11 Jul 2018 14:17:59 +0530 Subject: [PATCH 1/4] [IMP] mass_mailing: added unsubscribe link in plaintext theme As we are hiding snippet bar in plaintext theme, there is no way to add snippet with unsubscribe link. So we are adding it by default in plaintext theme --- addons/mass_mailing/views/themes_templates.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mass_mailing/views/themes_templates.xml b/addons/mass_mailing/views/themes_templates.xml index d6ce5a3aebf..f57c4500908 100644 --- a/addons/mass_mailing/views/themes_templates.xml +++ b/addons/mass_mailing/views/themes_templates.xml @@ -3,8 +3,11 @@ From 590679f868234c07e7f263171f3fa2c6fa9eea8b Mon Sep 17 00:00:00 2001 From: Anshuman Sharma Date: Thu, 12 Jul 2018 11:33:28 +0530 Subject: [PATCH 2/4] [IMP] mass_mailing: removed font-family from plain text Purpose behind this commit is to remove font-family from all elements in plaintext theme. So mail receiver will see this mail in default system font. This is inspired by new Gmail and suggested by FP As 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 as we don't having any assets in readonly mail editor. So we added stylesheet just for display purpose. --- .../mass_mailing/static/src/css/basic_theme_readonly.css | 7 +++++++ addons/mass_mailing/static/src/js/mass_mailing_editor.js | 8 ++++++++ addons/mass_mailing/views/editor_field_html.xml | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 addons/mass_mailing/static/src/css/basic_theme_readonly.css diff --git a/addons/mass_mailing/static/src/css/basic_theme_readonly.css b/addons/mass_mailing/static/src/css/basic_theme_readonly.css new file mode 100644 index 00000000000..340eec95a68 --- /dev/null +++ b/addons/mass_mailing/static/src/css/basic_theme_readonly.css @@ -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; +} diff --git a/addons/mass_mailing/static/src/js/mass_mailing_editor.js b/addons/mass_mailing/static/src/js/mass_mailing_editor.js index ec7f01bbc25..b5bc4915918 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -366,6 +366,14 @@ snippets_editor.Class.include({ 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; diff --git a/addons/mass_mailing/views/editor_field_html.xml b/addons/mass_mailing/views/editor_field_html.xml index 8a1a8845aa8..513be80933a 100644 --- a/addons/mass_mailing/views/editor_field_html.xml +++ b/addons/mass_mailing/views/editor_field_html.xml @@ -13,6 +13,9 @@ + + + From 40c029e44af227b6d816aeae29107dabe9a7198c Mon Sep 17 00:00:00 2001 From: Anshuman Sharma Date: Fri, 13 Jul 2018 15:26:52 +0530 Subject: [PATCH 3/4] [IMP] mass_mailing: hide snippetbar for plain text theme Purpose behind this commit is to disable snippets in plaintext theme. So here we hide it with css. And we hide plaintext theme option form style selector. So once user select another theme then user can only switch back theme except plaintext theme. --- .../static/src/scss/mass_mailing.ui.scss | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/mass_mailing/static/src/scss/mass_mailing.ui.scss b/addons/mass_mailing/static/src/scss/mass_mailing.ui.scss index ed4584cb61b..d41c5dc15a3 100644 --- a/addons/mass_mailing/static/src/scss/mass_mailing.ui.scss +++ b/addons/mass_mailing/static/src/scss/mass_mailing.ui.scss @@ -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; } From 072d7232ce5a1bab6789c0669be4d81b9c0ba478 Mon Sep 17 00:00:00 2001 From: Parth Gajjar Date: Fri, 13 Jul 2018 16:37:56 +0200 Subject: [PATCH 4/4] [IMP] mass_mailing: focus on content when user selects the plaintext theme --- addons/mass_mailing/static/src/js/mass_mailing_editor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_editor.js b/addons/mass_mailing/static/src/js/mass_mailing_editor.js index b5bc4915918..c7e95198005 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -362,6 +362,9 @@ snippets_editor.Class.include({ if (first_choice) { self._registerDefaultTexts($new_wrapper_content); + if(theme_params.name == 'basic') { + $editable_area.focusIn(); + } } self._disableUndroppableSnippets(); }