Favoritenseite jetzt OK
This commit is contained in:
+18
-2
@@ -2238,13 +2238,14 @@ $loggedIn = true;
|
|||||||
const locationsPanel = document.getElementById('favorites-panel-locations');
|
const locationsPanel = document.getElementById('favorites-panel-locations');
|
||||||
const searchPanel = document.getElementById('favorites-panel-search');
|
const searchPanel = document.getElementById('favorites-panel-search');
|
||||||
const trackedPanel = document.getElementById('favorites-panel-tracked');
|
const trackedPanel = document.getElementById('favorites-panel-tracked');
|
||||||
const groupCards = Array.from(document.querySelectorAll('[data-favorites-group]'));
|
|
||||||
|
|
||||||
if (tabButtons.length === 0 || tabPanels.length === 0 || !locationsPanel || !searchPanel || !trackedPanel) {
|
if (tabButtons.length === 0 || tabPanels.length === 0 || !locationsPanel || !searchPanel || !trackedPanel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let currentPanelId = 'favorites-panel-locations';
|
||||||
|
|
||||||
function activateTab(panelId, focusButton = false) {
|
function activateTab(panelId, focusButton = false) {
|
||||||
|
currentPanelId = panelId;
|
||||||
tabButtons.forEach((button) => {
|
tabButtons.forEach((button) => {
|
||||||
const isActive = button.dataset.tabTarget === panelId;
|
const isActive = button.dataset.tabTarget === panelId;
|
||||||
button.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
button.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
||||||
@@ -2254,6 +2255,9 @@ $loggedIn = true;
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Immer frisch abfragen, da HTMX OOB-Swaps die DOM-Elemente ersetzen.
|
||||||
|
const groupCards = Array.from(document.querySelectorAll('[data-favorites-group]'));
|
||||||
|
|
||||||
if (panelId === 'favorites-panel-locations') {
|
if (panelId === 'favorites-panel-locations') {
|
||||||
locationsPanel.hidden = false;
|
locationsPanel.hidden = false;
|
||||||
searchPanel.hidden = true;
|
searchPanel.hidden = true;
|
||||||
@@ -2300,6 +2304,12 @@ $loggedIn = true;
|
|||||||
activateTab(tabButtons[nextIndex].dataset.tabTarget, true);
|
activateTab(tabButtons[nextIndex].dataset.tabTarget, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Nach HTMX-OOB-Swap das aktive Tab erneut anwenden,
|
||||||
|
// da neu gerenderte Elemente kein hidden-Attribut haben.
|
||||||
|
document.body.addEventListener('htmx:afterSettle', function () {
|
||||||
|
activateTab(currentPanelId);
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
@@ -2567,6 +2577,12 @@ document.querySelectorAll('.favorites-loading-form').forEach((form) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
form.classList.remove('is-loading');
|
form.classList.remove('is-loading');
|
||||||
|
|
||||||
|
const hint = form.querySelector('[data-loading-hint]');
|
||||||
|
if (hint) {
|
||||||
|
hint.hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
form.querySelectorAll('button').forEach((button) => {
|
form.querySelectorAll('button').forEach((button) => {
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
button.removeAttribute('aria-busy');
|
button.removeAttribute('aria-busy');
|
||||||
|
|||||||
Reference in New Issue
Block a user