Skip to content

Commit 6a105c4

Browse files
author
jacquesbach
committed
Changes
1 parent 7f47e84 commit 6a105c4

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

static/js/layout.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ function initGridstack() {
2020
function injectDeleteButtons() {
2121
document.querySelectorAll('.grid-stack-item').forEach(item => {
2222

23-
// schon vorhanden? -> skip
23+
if (!item.id) {
24+
console.warn("Grid Item ohne ID:", item);
25+
return;
26+
}
27+
2428
if (item.querySelector('.card-delete-btn')) return;
2529

2630
const btn = document.createElement('div');
@@ -226,6 +230,7 @@ document.addEventListener("DOMContentLoaded", async () => {
226230
initGridstack();
227231
await loadLayout(); // Wartet, bis Boxen aus DB oder LocalStorage da sind
228232
await loadRemovedCards();
233+
injectDeleteButtons();
229234

230235
// --- PHASE 2: Startwerte für Datumsfelder setzen ---
231236
const t = new Date().toISOString().split('T')[0];

static/js/script.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,16 @@ async function unlockAdmin() {
4040

4141
document.getElementById('unlockBtn').style.display = 'none';
4242
document.getElementById('adminArea').style.display = 'flex';
43-
44-
injectDeleteButtons();
45-
toggleDeleteButtons(true);
46-
43+
4744
if (dashboardGrid) {
48-
// Grid bearbeitbar machen
4945
dashboardGrid.setStatic(false);
5046
document.getElementById('dashboard-grid').classList.add('edit-mode');
5147
}
48+
49+
setTimeout(() => {
50+
injectDeleteButtons();
51+
toggleDeleteButtons(true);
52+
}, 100);
5253

5354
loadTariffs();
5455
updateAdminCardList();

0 commit comments

Comments
 (0)