refactor(alpine): migrate remaining pages to x-init declarative initialization
- Remove DOMContentLoaded event listeners from analytics.ts and docs.ts - Rely on x-init attribute in templates for page initialization - Clean up unused exports from collections.ts Alpine data - Add x-init calls to admin_library, analytics, and docs templates - Normalize quote style in collections WebSocket script (single to double) - Disable Add Books button in collection detail (pending implementation)
This commit is contained in:
@@ -122,8 +122,6 @@ function renderPopularBooks(popular: PopularBooksResponse): void {
|
||||
.join("");
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", loadAnalytics);
|
||||
|
||||
export { loadAnalytics };
|
||||
|
||||
Alpine.data("analytics", () => ({
|
||||
|
||||
@@ -405,60 +405,32 @@ function filterIcons(searchTerm: string): void {
|
||||
|
||||
// Export functions globally
|
||||
export {
|
||||
addbooksToAdd,
|
||||
backToCollections,
|
||||
closeCollectionModal,
|
||||
createRule,
|
||||
deleteRule,
|
||||
filterCollectionBooks,
|
||||
filterIcons,
|
||||
hideAddBooksModal,
|
||||
initCollectionDetail,
|
||||
initColorSelection,
|
||||
initIconSelection,
|
||||
loadCollectionRules,
|
||||
loadCollections,
|
||||
navigateToCollection,
|
||||
populateIconGrid,
|
||||
removeBook,
|
||||
removebooksToAdd,
|
||||
searchBooksForCollections,
|
||||
selectColor,
|
||||
selectIcon,
|
||||
showAddBooksModal,
|
||||
showAllIcons,
|
||||
setupHTMXAuth,
|
||||
testRule,
|
||||
toggleBookForRemoval,
|
||||
toggleBookSelection,
|
||||
updateSelectedCount,
|
||||
};
|
||||
|
||||
Alpine.data("collections", () => ({
|
||||
addbooksToAdd,
|
||||
backToCollections,
|
||||
closeCollectionModal,
|
||||
createRule,
|
||||
deleteRule,
|
||||
filterCollectionBooks,
|
||||
filterIcons,
|
||||
hideAddBooksModal,
|
||||
initCollectionDetail,
|
||||
initColorSelection,
|
||||
initIconSelection,
|
||||
loadCollectionRules,
|
||||
loadCollections,
|
||||
navigateToCollection,
|
||||
populateIconGrid,
|
||||
removeBook,
|
||||
removebooksToAdd,
|
||||
searchBooksForCollections,
|
||||
selectColor,
|
||||
selectIcon,
|
||||
showAddBooksModal,
|
||||
showAllIcons,
|
||||
testRule,
|
||||
toggleBookForRemoval,
|
||||
toggleBookSelection,
|
||||
updateSelectedCount,
|
||||
}));
|
||||
|
||||
@@ -89,10 +89,6 @@ function performDocsSearch(query: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
initializeDocsSearch();
|
||||
});
|
||||
|
||||
Alpine.data("docs", () => ({
|
||||
toggleSidebar,
|
||||
initializeSearch: initializeDocsSearch,
|
||||
|
||||
Reference in New Issue
Block a user