Commit Graph

66 Commits

Author SHA1 Message Date
5051122bcd Refactor charts: dedicated nav tab, JSON data transport, tests
Replace the toggle-view approach and hidden DOM data carrier with a
proper dedicated Charts page:

- Move Charts out of Measurements view toggles into its own nav tab
  and route (GET /charts)
- ChartsController serializes readout data as JSON (ordered by
  taken_at); the view embeds it in a <script type="application/json">
  element instead of rendering a hidden copy of the measurements
  partial just to ferry data attributes to JS
- buildCharts() reads from the JSON element directly — no DOM parsing,
  no sorting in JS (server already orders the data)
- Turbo load handler detects the charts page via #charts-data presence
- Add controller tests (authentication, data shape, ordering,
  data isolation between users) and system tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:55:31 +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
3702e24153 Add taken_at to readouts and default unit to quantities
Readouts gain a taken_at timestamp (distinct from created_at) that records
when the measurement was actually taken. Measurements are now ordered by
taken_at descending.

Quantities gain an optional default_unit association. When set, the unit
is pre-selected in the measurement form. A "Set as default" button on the
unit selector lets users update the default directly from the form.

- Migrations: add taken_at (datetime) to readouts,
              add default_unit_id (fk → units) to quantities
- Readout: expose taken_at in ATTRIBUTES permit-list
- Quantity: add default_unit belongs_to, expose in ATTRIBUTES
- QuantitiesController: load @user_units for form actions
- Quantities views: add Default unit column and select to form
- Readouts form: pre-select default unit; add "Set as default" button
  (readoutUnitChanged / setDefaultUnit wired up in a later commit)
- Measurements form: default taken_at input to current time
- ApplicationHelper: propagate :form option to html_options in builder
- config/environments/test.rb: allow Capybara's dynamic host
- Tests: system tests for default-unit UI on the Quantities page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 22:01:52 +00:00
83b064ef3c Merge recover password/resend confirmation forms into sign in/register
Closes #65, #66
2026-03-01 20:04:42 +01:00
80130fb7d1 Allow cascade delete Unit/Quantity
Closes #32
2026-02-22 17:50:43 +01:00
1ba7d29441 Update tests to match labeled form changes 2026-02-22 00:55:21 +01:00
9d60eee16b Add Measurements tab and #new form 2025-01-25 16:34:04 +01:00
5fff9adf4d Delete Units respecting foreign key constraint 2025-01-16 20:46:22 +01:00
b3aea97087 Add Quantities tab 2025-01-05 03:18:39 +01:00
d250119601 Fix tests after routing/locale changes 2025-01-03 15:04:27 +01:00
b9d979ad0c Fix tests 2024-12-30 00:19:16 +01:00
8552571526 Disable Unit destuction for base units with subunits
Closes #40
2024-12-28 23:57:47 +01:00
bd40727231 Focus forms properly on open and close
Closes #44
2024-12-28 15:16:37 +01:00
8f85432982 Silence empty tests 2024-12-22 01:33:39 +01:00
d726e92445 Allow opening multiple new/edit forms
Closes #30
2024-12-21 17:52:45 +01:00
f0dab7a5f9 Fix Units new/edit display on validation errors
Add test_new_and_edit_on_validation_error
Closes #41
2024-12-17 01:53:25 +01:00
f472526aa8 Change variable name 2024-12-17 00:14:34 +01:00
e15b983b56 Avoid duplicated symbols, check created record attributes 2024-12-15 23:36:24 +01:00
30ee4a861e Define LINK_LABELS once. Generate Unicode random strings. 2024-12-14 19:40:01 +01:00
dcffa86e93 Rename add -> new in test descriptions 2024-12-12 00:53:23 +01:00
d5719b1e9d Fill multiplier field, confirm Add button disabled 2024-12-12 00:44:26 +01:00
3a25c1dbd0 Equally sample add unit/add subunit/edit links for test 2024-12-12 00:35:11 +01:00
bb4fbb3adc Refine "add and edit disallow opening multiple forms" test 2024-12-10 18:11:13 +01:00
dc92a333be Fix UnitsTest#test_add_unit 2024-12-10 01:18:27 +01:00
f3f0b9dc9e Fix UnitsiTest#test_index 2024-12-09 20:00:14 +01:00
40808639cc Update tests to new schema 2024-12-08 15:29:01 +01:00
537cd18336 Change namespace for defaults controllers
To allow proper path prefix for view partials when using
config.action_view.prefix_partial_path_with_controller_namespace
2024-11-09 21:50:50 +01:00
965cb76f1d Generate Units::Defaults controller
bin/rails g controller Units/Defaults index
2024-05-04 01:53:57 +02:00
ebae0334d9 Test refinements 2024-03-16 16:07:50 +01:00
3872acacc6 Fix flaky testing of emails on async actions 2024-03-16 16:06:16 +01:00
8b81ae2dc5 Test Unit form opening/closing 2024-02-13 01:04:27 +01:00
1227c54e0e Fix flashes display after grid introduction
Closes #5
2024-01-17 21:57:18 +01:00
651534134e Refine tests 2024-01-17 05:41:08 +01:00
7cfa3a0af0 Refine Unit tests 2024-01-17 04:25:32 +01:00
dec3af27bf Migrate Users views to grid layout + turbo_stream
Closes #7
2024-01-17 03:30:04 +01:00
93929f2c07 Change User#disguise/revert to GET 2024-01-15 01:07:45 +01:00
a4f113ad48 Downgrade importmap-rails to 1.2
v2.0.1 down not fire turbo:load event in test env, which causes tests to
fail.
Issue reported: https://github.com/rails/importmap-rails/issues/233
2024-01-12 19:30:09 +01:00
0801e8059c Close form on Esc key. Localize submit button. 2024-01-06 18:06:36 +01:00
d1bfabc105 Better string input randomization 2024-01-06 01:05:28 +01:00
5c70736a91 Reword comments/descriptions 2024-01-05 21:56:57 +01:00
98c8fb9346 Validate Unit string lengths 2024-01-05 21:32:59 +01:00
d28ef26dc5 Manage focus on form show/hide 2024-01-05 21:07:12 +01:00
32b8daf29d Add Unit system tests 2024-01-05 04:16:38 +01:00
7dc73dd66d bundle update 2023-11-18 19:02:51 +01:00
5b6e986170 Test user status update 2023-05-21 17:33:13 +02:00
f76344c220 Add action confirmation dialog 2023-05-14 17:57:20 +02:00
e4f595a329 Fix translations and enable i18n testing 2023-05-14 16:37:53 +02:00
54d8bc6b55 Fix typo 2023-05-14 16:17:08 +02:00
5e09adeae7 Update tests to use buttons
Add disguise/revert tests
2023-05-14 15:57:12 +02:00
a7fce807c5 Add Users#show 2023-05-05 18:29:11 +02:00