Commit Graph

6 Commits

Author SHA1 Message Date
67f519052a Extract disableElement/enableElement to shared module
Stimulus controllers were reaching into Turbo.StreamElement.prototype
to call disableElement/enableElement — tight coupling to Turbo internals.

Extract both functions to app/javascript/element_helpers.js and import
from there in application.js (which still assigns them to the Turbo
prototype for server-driven Turbo Stream actions), details_controller,
and readout_unit_controller.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 14:19:49 +00:00
fee3ce8627 Migrate all inline JS to Stimulus controllers
Add stimulus-rails gem and wire up 7 controllers:
- measurements_view_controller: view toggle (compact/wide) via localStorage
- measurements_controller: grouped rows MutationObserver
- charts_controller: Plotly chart rendering
- form_controller: keyboard shortcuts (Escape/Enter) and submit validation
- details_controller: quantity picker state, focusout close, MutationObserver
- readout_unit_controller: default unit button enable/disable + PATCH submission
- drag_controller: drag-and-drop for quantity reparenting and unit rebasing

Remove all inline onclick/onkeydown/ondrag*/onsubmit handlers from templates.
Remove all window.* global exports from application.js.
Remove bare <script> block from measurements/_form.html.erb.
Remove turbo:load listeners for behavior now in controller connect().

application.js now only contains: Turbo Stream custom action definitions
and the showPage visibility listener.

Document Stimulus conventions in CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 13:44:44 +00:00
8c6d296021 Enable turbo (without Drive) 2023-12-03 23:27:10 +01:00
3509cd409c Remove turbo and importmap 2023-05-14 16:19:42 +02:00
66f098f479 Add and install 'turbo-rails'
bin/rails turbo:install
2023-04-02 00:12:31 +02:00
526c285188 bin/rails importmap:install 2023-04-01 23:53:05 +02:00