Fix collections page Alpine errors and modal container issues
Fixed multiple issues preventing the collections page and modals from working correctly: 1. Alpine Expression Error on page load: - Added missing semicolon between function calls in x-init directive - Added missing parentheses to initializeCollectionWebSocket() call - Collections page now loads without JavaScript errors 2. Modal container removal bug: - Fixed closeCollectionModal() removing #modal-container parent element - Changed from modal.parentElement.remove() to modal.remove() - Modal can now be opened and closed multiple times without errors - Fixes htmx:targetError when trying to open modal after first close 3. Emoji grid display: - Modal now properly preserves container across open/close cycles - setupHTMXModalInit() can successfully repopulate icon grid - Emoji picker displays correctly on all modal opens Technical details: - templates/collections.templ: Fixed x-init syntax errors - web/src/collections.ts: Fixed modal close logic to preserve container - Modal container persists across HTMX swaps, allowing repeated use
This commit is contained in:
@@ -12,7 +12,7 @@ templ Collection(user User, collections []CollectionData, errorMessage string) {
|
||||
<script src="/static/htmx.min.js"></script>
|
||||
<link href="/static/style.css" rel="stylesheet"/>
|
||||
</head>
|
||||
<body x-data="collections" x-init="initializeCollectionWebSocket() setupHTMXModalInit()" class="theme-{ user.Theme }">
|
||||
<body x-data="collections" x-init="initializeCollectionWebSocket(); setupHTMXModalInit()" class="theme-{ user.Theme }">
|
||||
@Header(user, "/collections")
|
||||
<!-- Modal Container -->
|
||||
<div id="modal-container"></div>
|
||||
@@ -110,7 +110,7 @@ templ CollectionDetail(user User, collection CollectionData, books []handlers.Bo
|
||||
<script src="/static/htmx.min.js"></script>
|
||||
<link href="/static/style.css" rel="stylesheet"/>
|
||||
</head>
|
||||
<body x-data="collections" x-init="initializeCollectionWebSocket" class="theme-{ user.Theme }">
|
||||
<body x-data="collections" x-init="initializeCollectionWebSocket()" class="theme-{ user.Theme }">
|
||||
@Header(user, "/collections")
|
||||
<div class="w-full px-4 sm:px-6 lg:px-8 py-8">
|
||||
<div class="mb-6">
|
||||
|
||||
Reference in New Issue
Block a user