Add HTMX migration for server-rendered tables and lazy loading

- Add HTMX CDN to layout
- Replace client-side table rendering (displayRatings, displayCourses)
  with server-rendered EJS partials via hx-get
- Add server-side course search with debounced hx-trigger
- Lazy-load player history and course layouts via htmx.ajax()
- Render rating chart via htmx:afterSwap with data attributes
- Add partial routes: ratings-table, course-table, player-history,
  course-layouts
This commit is contained in:
Samuel Enocsson
2026-02-19 08:29:56 +01:00
parent 20bbdbbfcf
commit 7e5fa6cbf1
12 changed files with 468 additions and 527 deletions
+6 -5
View File
@@ -4,11 +4,13 @@
type="text"
class="search-input"
id="course-search"
name="q"
placeholder="Search courses by name or city..."
oninput="searchCourses()"
hx-get="/partials/course-table"
hx-trigger="input changed delay:300ms, search"
hx-target="#courses-table"
/>
</div>
<div id="search-results-info" class="search-results-info"></div>
<div class="controls">
<button class="btn" onclick="scrapeCourses()" id="scrape-courses-btn">
@@ -17,7 +19,7 @@
</div>
<div id="loading" class="loading" style="display: none;">Loading courses...</div>
<div id="courses-table"></div>
<div id="courses-table" hx-get="/partials/course-table" hx-trigger="load"></div>
`; %>
<%- include('../partials/layout', {
@@ -26,6 +28,5 @@
activePage: 'courses',
cssFiles: ['courses.css'],
jsFiles: ['courses.js'],
initScript: 'loadCourses();',
body: body
}) %>
}) %>