Closed
Conversation
|
✅ @Copilot — Superconductor finished — View implementation | App Preview Standing by for instructions. |
Agent-Logs-Url: https://github.com/berkeley-cdss/flextensions/sessions/1cb19152-1f25-47aa-9581-0a2a89610486 Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
…, add clarifying comment Agent-Logs-Url: https://github.com/berkeley-cdss/flextensions/sessions/1cb19152-1f25-47aa-9581-0a2a89610486 Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Setup HTMX for use with Rails for front end JS
Use HTMX for Front End JS
Apr 10, 2026
Contributor
|
Interesting draft, but closing for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
General Info
Changes
Integrates HTMX 2.0.8 into the Rails importmap pipeline and migrates all appropriate AJAX interactions from hand-written Stimulus
fetchcalls to declarative HTMX attributes.Installation
htmx.org.js(ESM build) atvendor/javascript/htmx.org.js"htmx.org"inconfig/importmap.rbwindow.htmxinapplication.jsRails CSRF + Flash bridge (application.js)
htmx:configRequest→ injectsX-CSRF-Tokeninto every HTMX requesthtmx:afterRequest→ parsesHX-Triggerresponse header and firesCustomEvent("flash")consumed by the existing flash Stimulus controllerhtmx:sendError→ rolls back checkbox state and shows network-error flash (distinct from per-elementhx-on::htmx:response-errorwhich handles non-2xx HTTP responses)Front-end interactions converted to HTMX
hx-patch+hx-vals='js:{...}';hx-on::htmx:response-errorrolls back checkboxhx-post+ serverHX-Refresh: trueDataTables initialization, Bootstrap modals, local date calculations, and sidebar/color-mode logic stay in Stimulus — no HTMX replacement makes sense there.
Server-side (fully backward-compatible)
Controllers detect
HX-Requestheader and branch accordingly:Non-HTMX callers (existing RSpec controller tests, API consumers) receive the original JSON responses unchanged.
Stimulus controllers cleaned up — removed
toggleAssignment,sync,toggleExtended, and_dispatchFlashfromassignment_controller.jsandenrollments_controller.js; DataTables init remains.Testing
Existing RSpec controller specs for
AssignmentsController,UserToCoursesController, andCoursesControllercover the non-HTMX code paths and are unmodified. The HTMX-specific paths (CSRF injection, HX-Trigger flash, HX-Refresh) are exercised through the browser; no headless JS test infrastructure is currently in place for Stimulus/HTMX interaction tests.Documentation
No additional documentation required. HTMX attributes are self-documenting in the HTML and the HTMX docs cover all used attributes.
Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.jsdelivr.net/usr/bin/curl curl -s REDACTED(dns block)cdn.skypack.dev/usr/bin/curl curl -sv REDACTED -o /tmp/htmx.test.js(dns block)esm.sh/usr/bin/curl curl -sv REDACTED -o /tmp/htmx.test2.js(dns block)ga.jspm.io/usr/bin/curl curl -sv REDACTED -o /tmp/htmx.min.js(dns block)https://api.github.com/repos/bigskysoftware/htmx/releases/latest/usr/bin/curl curl -s REDACTED(http block)unpkg.com/usr/bin/curl curl -sI REDACTED(dns block)/usr/bin/curl curl -s REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either: