[REM] mass_mailing: remove unnecessary table-related snippet

`mass_mailing_table_item` was charged with ensuring proper cloning and
removing of table elements precisely because `mass_mailing` relied so
heavily on them. Since it doesn't anymore, there is no need for that
option. This removes it.

task-2554899

X-original-commit: 386848568adb8e11f57e458cb7862cb3058b07c9
Part-of: odoo/odoo#77724
This commit is contained in:
Antoine Guenet
2021-10-04 15:31:07 +00:00
parent d0c2d8e9a1
commit b3706f1afc
2 changed files with 0 additions and 50 deletions
@@ -81,52 +81,6 @@ options.registry.mass_mailing_sizing_x = options.Class.extend({
},
});
options.registry.mass_mailing_table_item = options.Class.extend({
onClone: function (options) {
this._super.apply(this, arguments);
// If we cloned a td or th element...
if (options.isCurrent && this.$target.is("td, th")) {
// ... and that the td or th element was alone on its row ...
if (this.$target.siblings().length === 1) {
var $tr = this.$target.parent();
$tr.clone().empty().insertAfter($tr).append(this.$target); // ... move the clone in a new row instead
return;
}
// ... if not, if the clone neighbor is an empty cell, remove this empty cell (like if the clone content had been put in that cell)
var $next = this.$target.next();
if ($next.length && $next.text().trim() === "") {
$next.remove();
return;
}
// ... if not, insert an empty col in each other row, at the index of the clone
var width = this.$target.width();
var $trs = this.$target.closest("table").children("thead, tbody, tfoot").addBack().children("tr").not(this.$target.parent());
_.each($trs.children(":nth-child(" + this.$target.index() + ")"), function (col) {
$(col).after($("<td/>", {style: "width: " + width + "px;"}));
});
}
},
onRemove: function () {
this._super.apply(this, arguments);
// If we are removing a td or th element which was not alone on its row ...
if (this.$target.is("td, th") && this.$target.siblings().length > 0) {
var $trs = this.$target.closest("table").children("thead, tbody, tfoot").addBack().children("tr").not(this.$target.parent());
if ($trs.length) { // ... if there are other rows in the table ...
var $last_tds = $trs.children(":last-child");
if (_.reduce($last_tds, function (memo, td) { return memo + (td.innerHTML || ""); }, "").trim() === "") {
$last_tds.remove(); // ... remove the potential full empty column in the table
} else {
this.$target.parent().append("<td/>"); // ... else, if there is no full empty column, append an empty col in the current row
}
}
}
},
});
// Adding compatibility for the outlook compliance of mailings.
// Commit of such compatibility : a14f89c8663c9cafecb1cc26918055e023ecbe42
options.registry.BackgroundImage = options.registry.BackgroundImage.extend({
@@ -372,10 +372,6 @@
data-selector="img, .mv, .col_mv, td, th"
data-exclude=".o_mail_no_resize, .o_mail_no_options"/>
<div data-js="mass_mailing_table_item"
data-selector="td, th"
data-exclude=".o_mail_no_options"/>
<div data-js="table_row"
data-selector="tr:has(> .row), tr:has(> .col_mv)"
data-exclude=".o_mail_no_options"