366662a948
Replace JS-generated wide table with ERB partial and Turbo Streams
...
- Add _wide_table.html.erb partial (server-rendered pivot table)
- Add load_measurements helper in controller to prepare @wide_groups and
@wide_quantities for all mutating actions
- Update index view to render the wide_table partial in #measurements-wide
- Add/update create, destroy, update turbo_stream views to refresh the
wide table atomically after each mutation
- Remove buildWideTable() and editMeasurementWide() from application.js
- Fix create.turbo_stream.erb condition (empty readouts are vacuously all persisted)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-04 12:28:32 +00:00
1bc75f5d40
Fix column header lookup fragility, add fetch error handling, add tests
...
- Replace position-based column header lookup (ths[3]/ths[4]) with
data-column attribute selectors — immune to column reordering
- Add .catch() error handlers to editMeasurementWide and setDefaultUnit
fetch calls so failures surface in the console instead of silently
disappearing
- Add MeasurementsController integration tests covering index auth,
create with taken_at, empty-readout create, destroy, cross-user
destroy isolation, and update
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-04 10:24:26 +00:00
bfd427c9b2
Add wide view and inline editing to Measurements page
...
The Measurements page gains a compact/wide view toggle (persisted in
localStorage). The wide view is a pivot table: rows = time points,
columns = quantity names (alphabetical), cells = value + delete button.
Clicking a value in either view opens an inline edit panel (Turbo Stream)
without leaving the page. The panel shows the quantity name, value input,
unit selector, taken_at picker, and Update/Cancel buttons.
Changes:
- MeasurementsController: add edit/update actions; order by taken_at desc
- measurements/index: compact table + wide container, view-toggle buttons
- measurements/_readout: data-* attributes for JS pivot builder; edit link
- measurements/_edit_panel, _edit_form, _edit_form_close,
edit.turbo_stream, update.turbo_stream: inline edit views
- application.js: groupMeasurements, buildWideTable (alphabetical cols),
getMeasurementsView / setMeasurementsView, editMeasurementWide,
readoutUnitChanged, setDefaultUnit
- application.css: compact/wide visibility rules, .wide-cell flex layout,
button.link reset, .items-table .form td alignment
- Pictograms: view-rows.svg, view-columns.svg (view-toggle icons)
- Locale: view_compact/view_wide toggle labels, edit link, update.success
- Tests: system tests for compact inline edit and wide view edit panel
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-03 22:03:10 +00:00