diff options
| author | Jeremy Kersten <jke@odoo.com> | 2017-06-16 09:18:06 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2017-06-16 12:59:55 +0200 |
| commit | 08bd178e288ff08ca1fbd069ac9a35bf9a229fc7 (patch) | |
| tree | 5083215e2bcea350a6602e14244be9207c98e3fa /addons/mass_mailing/static/src/js | |
| parent | 2f6edfef49430f8c571c7cf0e485a22f6a0867d4 (diff) | |
[IMP] mass_mailing: allow to don't wrap a template in a table
In some case we don't want to wrap the content to be centered.
Now, you can add a data-nowrap when you define the theme params to
don't wrap it in a table automatically
Eg:
<div data-name="blank"
data-img="/xxx"
>> data-nowrap="1"
data-images-info='{...}'>
Diffstat (limited to 'addons/mass_mailing/static/src/js')
| -rw-r--r-- | addons/mass_mailing/static/src/js/mass_mailing_editor.js | 22 |
1 files changed, 15 insertions, 7 deletions
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 5d475808589..593ed6140cd 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -170,6 +170,7 @@ snippets_editor.Class.include({ className: classname || "", img: $theme.data("img") || "", template: $theme.html().trim(), + nowrap: !!$theme.data('nowrap'), get_image_info: function (filename) { if (images_info[filename]) { return images_info[filename]; @@ -331,13 +332,20 @@ snippets_editor.Class.include({ var $old_layout = $editable_area.find(".o_layout"); // This wrapper structure is the only way to have a responsive and // centered fixed-width content column on all mail clients - var $new_wrapper = $('<table/>', {class: 'o_mail_wrapper'}); - var $new_wrapper_content = $("<td/>", {class: 'o_mail_no_resize o_mail_wrapper_td oe_structure'}); - $new_wrapper.append($('<tr/>').append( - $("<td/>", {class: 'o_mail_no_resize'}), - $new_wrapper_content, - $("<td/>", {class: 'o_mail_no_resize'}) - )); + var $new_wrapper, $new_wrapper_content; + + if (theme_params.nowrap) { + $new_wrapper = $new_wrapper_content = $("<div/>", {"class": "oe_structure"}); + } + else { + $new_wrapper = $('<table/>', {class: 'o_mail_wrapper'}); + $new_wrapper_content = $("<td/>", {class: 'o_mail_no_resize o_mail_wrapper_td oe_structure'}); + $new_wrapper.append($('<tr/>').append( + $("<td/>", {class: 'o_mail_no_resize'}), + $new_wrapper_content, + $("<td/>", {class: 'o_mail_no_resize'}) + )); + } var $new_layout = $("<div/>", {"class": "o_layout " + theme_params.className}).append($new_wrapper); var $contents; |
