[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='{...}'>
This commit is contained in:
Jeremy Kersten
2017-06-16 12:59:55 +02:00
parent 2f6edfef49
commit 08bd178e28
@@ -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;