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>
25 lines
868 B
Plaintext
25 lines
868 B
Plaintext
<%= tabular_fields_for @readout, form: form_tag do |form| %>
|
|
<%- tag.tr id: row, class: "form", onkeydown: "formProcessKey(event)",
|
|
data: {form: form_tag, hidden_row: hidden_row, link: link} do %>
|
|
<td><%= @readout.quantity %></td>
|
|
<td class="ralign">
|
|
<%= form.number_field :value, required: true, autofocus: true %>
|
|
</td>
|
|
<td>
|
|
<%= form.collection_select :unit_id, @user_units, :id,
|
|
->(u){ sanitize(' ' * (u.base_id? ? 1 : 0) + u.symbol) },
|
|
{}, required: true %>
|
|
</td>
|
|
<td>
|
|
<%= form.datetime_field :taken_at %>
|
|
</td>
|
|
<td></td>
|
|
<td class="flex">
|
|
<%= form.button %>
|
|
<%= image_link_to t(:cancel), "close-outline", measurements_path,
|
|
class: 'dangerous', name: :cancel,
|
|
onclick: render_turbo_stream('edit_form_close', {row: row}) %>
|
|
</td>
|
|
<% end %>
|
|
<% end %>
|