openstreetmap-website/app/assets/javascripts/messages.js
Anton Khorev a84c1cb89d Remove .message-summary css classes and selectors
They are not necessary because they select every table body row, and the table already has its own class.
2024-04-30 06:49:30 +03:00

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();
});
}
});
});