forked from fixin.me/fixin.me
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>
39 lines
1.5 KiB
Plaintext
39 lines
1.5 KiB
Plaintext
<%# TODO: show hint when no quantities/units defined %>
|
|
<div class="rightside-area buttongrid">
|
|
<% if current_user.at_least(:active) %>
|
|
<%= image_link_to t('.new_measurement'), 'plus-outline', new_measurement_path,
|
|
id: :new_measurement_link, onclick: 'this.blur();',
|
|
data: {turbo_stream: true} %>
|
|
<% end %>
|
|
<%= image_button_tag '', 'view-rows', name: nil, type: 'button',
|
|
class: 'view-toggle', title: t('.view_compact'),
|
|
data: {view: 'compact'}, onclick: "setMeasurementsView('compact')" %>
|
|
<%= image_button_tag '', 'view-columns', name: nil, type: 'button',
|
|
class: 'view-toggle', title: t('.view_wide'),
|
|
data: {view: 'wide'}, onclick: "setMeasurementsView('wide')" %>
|
|
</div>
|
|
|
|
<div class="main-area measurements-section">
|
|
<%= tag.div id: :measurement_edit_form %>
|
|
<table class="items-table measurements-compact">
|
|
<thead>
|
|
<tr>
|
|
<th><%= Quantity.model_name.human %></th>
|
|
<th><%= Readout.human_attribute_name(:value) %></th>
|
|
<th><%= Unit.model_name.human %></th>
|
|
<th><%= Readout.human_attribute_name(:taken_at) %></th>
|
|
<th><%= Readout.human_attribute_name(:created_at) %></th>
|
|
<% if current_user.at_least(:active) %>
|
|
<th></th>
|
|
<% end %>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="measurements">
|
|
<%= render(partial: 'readout', collection: @measurements, as: :readout) || render_no_items %>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div id="measurements-wide" class="measurements-wide"></div>
|
|
</div>
|
|
|