updated season league view page
This commit is contained in:
@@ -236,45 +236,18 @@ function sortRolesColumn(field, currentOrder, currentOrderBy) {
|
||||
}
|
||||
|
||||
// Handle HTMX navigation and initialization
|
||||
// Tab navigation active state is handled by tabs.js (generic).
|
||||
// This file only handles admin-specific concerns (flatpickr, multi-select).
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// Initialize flatpickr on page load
|
||||
initFlatpickr();
|
||||
|
||||
// Update active nav item after HTMX navigation
|
||||
document.body.addEventListener("htmx:afterSwap", function (event) {
|
||||
if (event.detail.target.id === "admin-content") {
|
||||
// Get the current URL path
|
||||
const path = window.location.pathname;
|
||||
const section = path.split("/").pop() || "users";
|
||||
|
||||
// Update active state on nav items
|
||||
document.querySelectorAll("nav a").forEach(function (link) {
|
||||
const href = link.getAttribute("href");
|
||||
if (href && href.includes("/" + section)) {
|
||||
link.classList.remove(
|
||||
"border-transparent",
|
||||
"text-subtext0",
|
||||
"hover:text-text",
|
||||
"hover:border-surface2"
|
||||
);
|
||||
link.classList.add("border-blue", "text-blue", "font-semibold");
|
||||
} else {
|
||||
link.classList.remove("border-blue", "text-blue", "font-semibold");
|
||||
link.classList.add(
|
||||
"border-transparent",
|
||||
"text-subtext0",
|
||||
"hover:text-text",
|
||||
"hover:border-surface2"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Re-initialize flatpickr after content swap
|
||||
initFlatpickr();
|
||||
}
|
||||
|
||||
// Re-initialize flatpickr when audit results are updated
|
||||
if (event.detail.target.id === "audit-results-container") {
|
||||
// Re-initialize flatpickr after admin content swap
|
||||
if (
|
||||
event.detail.target.id === "admin-content" ||
|
||||
event.detail.target.id === "audit-results-container"
|
||||
) {
|
||||
initFlatpickr();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user