From 06594855d6c43e3c96c3d5fc199055e906eff939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Fri, 16 Feb 2024 12:32:37 +0100 Subject: [PATCH] Fix stuck tooltips Fix stuck tooltips by implementing custom data request function, and destroying existing tooltips on new data load. Fixes #81 --- backend/templates/base.html | 8 ++++++++ backend/templates/main.html | 2 +- backend/templates/main_admin.html | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/templates/base.html b/backend/templates/base.html index d95c1d8..df6d642 100644 --- a/backend/templates/base.html +++ b/backend/templates/base.html @@ -187,6 +187,14 @@ return entries; } + function dataRequestQueueAndDestroyTooltips(params) { + document.querySelectorAll(".tooltip[role='tooltip']").forEach((tooltip) => tooltip.remove()); + var base_url = "/api/queue" + $.get(base_url).then((res) => { + params.success(res); + }); + } + diff --git a/backend/templates/main.html b/backend/templates/main.html index 86fa26c..fef4295 100644 --- a/backend/templates/main.html +++ b/backend/templates/main.html @@ -4,7 +4,7 @@ Eintragen + data-ajax="dataRequestQueueAndDestroyTooltips" data-show-refresh="true" data-auto-refresh="true" data-auto-refresh-interval="10"> @@ -153,7 +153,7 @@ $.ajax({ type: 'POST', url: '/api/entries/delete', - data: JSON.stringify(ids), // or JSON.stringify ({name: 'jonas'}), + data: JSON.stringify(ids), error: function () { bootbox.alert({ message: "Fehler beim Löschen der Eintragungen.",