Commit Graph

74 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
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
33004f62bd Improve Measurement form layout and styling 2026-03-22 01:06:38 +01:00
687e6fcdff Drop Readout.value decimal type in favor of float 2026-03-19 20:30:16 +01:00
a9091d76a8 Merge styles of <a>.button/<button>/<input type="submit"> into .button
Remove flash button
Fix some multi-selector specificity differences
2026-03-04 17:13:11 +01:00
83b064ef3c Merge recover password/resend confirmation forms into sign in/register
Closes #65, #66
2026-03-01 20:04:42 +01:00
84945fa4b4 Simplify and improve labeled form 2026-02-22 00:53:18 +01:00
bd1a664caa Measurement form based on select-styled <details> 2026-01-31 17:22:09 +01:00
d9bd2b46e3 Fix svg_tag display on Users tab 2025-07-26 23:24:54 +02:00
e12369cea1 Measurements#new form improvements 2025-05-13 22:30:58 +02:00
cd9a64b5ad Merge corrections provided by Bambuch 2025-04-26 18:32:45 +02:00
c48bf290fd Implement Measurements#new 2025-02-18 11:25:32 +01:00
9d60eee16b Add Measurements tab and #new form 2025-01-25 16:34:04 +01:00
b3aea97087 Add Quantities tab 2025-01-05 03:18:39 +01:00
b133b2be7c Add seperate 'no items' message for defaults
Closes #53
2025-01-03 18:47:56 +01:00
af152c5e8b Disable links instead of hiding
Closes #49
2025-01-03 14:41:18 +01:00
5dd3303019 Disable Turbo in User forms/links 2025-01-02 19:20:08 +01:00
fd4c7259b0 Move navigation tab labels 2025-01-02 02:48:33 +01:00
a6e3833fd0 Extend custom FormBuilder to DRY in forms
Closes #8
Closes #45
2025-01-01 16:26:58 +01:00
bd40727231 Focus forms properly on open and close
Closes #44
2024-12-28 15:16:37 +01:00
a9307ad455 Form uses button instead of input to display SVG 2024-12-23 00:47:44 +01:00
0659c1e1c1 Don't render index on Unit actions 2024-12-22 01:31:14 +01:00
e5cf3dc0ae Avoid refreshing whole index on create 2024-12-19 03:46:29 +01:00
ba8ac5d2fa Remove unnecessary link_id 2024-12-17 02:44:52 +01:00
d5719b1e9d Fill multiplier field, confirm Add button disabled 2024-12-12 00:44:26 +01:00
7e5f873cde Change helper into BigDecimal method 2024-12-06 15:24:25 +01:00
f4ca1e91fa Mark redirecting buttons with trailing '...'
Closes #2
2024-11-23 23:26:08 +01:00
e75391ae18 Display User name using #to_s 2024-11-23 14:55:29 +01:00
279f9bd6ac Display Defaults hierarchy including same base Units 2024-11-22 03:10:08 +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
1b6bda4e70 Remove image_element_to helper 2024-05-06 19:04:56 +02:00
aa83f17a4c Allow specifying navigation tab for controllers 2024-05-06 19:01:54 +02:00
965cb76f1d Generate Units::Defaults controller
bin/rails g controller Units/Defaults index
2024-05-04 01:53:57 +02:00
1966c782bc Unit rebase as a separate action 2024-04-02 22:16:27 +02:00
f298acd726 Display errors for table-embedeed forms 2024-03-15 02:40:17 +01:00
2c0466b51a Allow display of multiple flash messages 2024-03-15 02:29:58 +01:00
1198add901 Rewrite stream rendering to avoid client-side expanding
* adding streams in client breaks things (e.g. autofocus)
* some tasks need to be performed in one stream action to avoid
  flickering (e.g. table row substitution)
2024-02-11 18:31:06 +01:00
76aae56ed5 Allow stream action to expand into multiple actions
e.g. by including 'onclick()' event handler
2024-02-04 20:05:36 +01:00
13c1d5684b Don't wrap form labels 2024-01-22 02:35:14 +01:00
a7f80a575c Manage client-side js with turbo_stream actions 2024-01-22 02:14:01 +01:00
1227c54e0e Fix flashes display after grid introduction
Closes #5
2024-01-17 21:57:18 +01:00
5047d4909f Render units from collection, without redirects 2024-01-15 18:45:30 +01:00
8d63ed62ea Render flash messages for html and turbo_stream 2024-01-14 03:19:20 +01:00
92350ac3f2 Display new form with turbo frame 2024-01-03 01:02:29 +01:00
588bc01911 Fill <td> with <a> link using ::after pseudoelement 2023-12-05 23:36:56 +01:00
bad64c5dbf Expand link to whole table cell 2023-12-05 19:10:36 +01:00
d98057caad Upgrade layout to grid+flex 2023-12-04 20:36:03 +01:00
761aad358a Print multiplier in scientific notation 2023-11-18 19:19:28 +01:00
a4745c9cb8 Add Units 2023-07-06 18:34:16 +02:00
9ecdd10b2d Fix passing options for form fields 2023-05-17 23:38:41 +02:00