Files
fixin.me/app/views/measurements/_readout.html.erb
barbie-bot eb8fe7622a Fix autofocus on dynamically inserted forms, remove this.blur() handlers
form_controller.connect() now blurs the previously focused element and
explicitly focuses the [autofocus] element when a form is inserted into
the DOM (via Turbo Stream). Only runs when an [autofocus] element is
present, so closing forms and other stream updates are unaffected.

Remove all onclick='this.blur()' inline handlers from templates — they
were a workaround for the same autofocus problem, now solved properly
via the Stimulus lifecycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 14:16:34 +00:00

23 lines
929 B
Plaintext

<%= tag.tr id: dom_id(readout), data: {taken_at: readout.taken_at&.iso8601,
quantity_id: readout.quantity_id, quantity_name: readout.quantity.name,
value: format("%.10g", readout.value), unit: readout.unit.symbol} do %>
<td>
<% if current_user.at_least(:active) %>
<%= link_to readout.quantity, edit_measurement_path(readout),
class: 'link', data: {turbo_stream: true} %>
<% else %>
<%= readout.quantity %>
<% end %>
</td>
<td class="ralign"><%= format("%.10g", readout.value) %></td>
<td><%= readout.unit %></td>
<td class="taken-at"><%= l(readout.taken_at) if readout.taken_at %></td>
<td class="created-at"><%= l(readout.created_at) %></td>
<% if current_user.at_least(:active) %>
<td class="flex">
<%= image_button_to t('.destroy'), 'delete-outline', measurement_path(readout),
method: :delete, data: {turbo_stream: true} %>
</td>
<% end %>
<% end %>