They are not necessary because they select every table body row, and the table already has its own class.
16 lines
554 B
JavaScript
16 lines
554 B
JavaScript
$(document).ready(function () {
|
|
$(".messages-table .destroy-message").on("turbo:submit-end", function (event) {
|
|
if (event.detail.success) {
|
|
event.target.dataset.isDestroyed = true;
|
|
}
|
|
});
|
|
|
|
$(".messages-table tbody tr").on("turbo:before-morph-element", function (event) {
|
|
if ($(event.target).find("[data-is-destroyed]").length > 0) {
|
|
event.preventDefault(); // NB: prevent Turbo from morhping/removing this element
|
|
$(event.target).fadeOut(800, "linear", function () {
|
|
$(this).remove();
|
|
});
|
|
}
|
|
});
|
|
});
|