forked from fixin.me/fixin.me
Users can now switch to a Charts view that renders a separate time-series line chart for each tracked quantity, using Plotly.js loaded via CDN. Charts are sorted chronologically and styled to match the app palette. A dedicated toggle button and matching CSS visibility rules mirror the existing Compact/Wide view pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.7 KiB
Plaintext
43 lines
1.7 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')" %>
|
|
<%= image_button_tag '', 'chart-line', name: nil, type: 'button',
|
|
class: 'view-toggle', title: t('.view_charts'),
|
|
data: {view: 'charts'}, onclick: "setMeasurementsView('charts')" %>
|
|
</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 id="measurements-charts" class="measurements-charts"></div>
|
|
</div>
|
|
|