forked from fixin.me/fixin.me
27 lines
929 B
Plaintext
27 lines
929 B
Plaintext
<% @readouts.each do |readout| %>
|
|
<%= tabular_fields_for 'readouts[]', readout do |form| %>
|
|
<% row = dom_id(form.object.quantity, :new, :readout) %>
|
|
<%- tag.tr id: row, onkeydown: 'processKey(event)' do %>
|
|
<td>
|
|
<%= form.object.quantity.pathname.delete_prefix(@closest_ancestor.pathname) %>
|
|
<%= form.hidden_field :quantity_id %>
|
|
</td>
|
|
<td>
|
|
<%= form.number_field :value, required: true, autofocus: true,
|
|
size: 10 %>
|
|
</td>
|
|
<td>
|
|
<%= form.select :unit_id, options_from_collection_for_select(
|
|
@units, :id, ->(u){ sanitize(' '*(u.base_id ? 1 : 0) + u.symbol) }
|
|
) %>
|
|
</td>
|
|
|
|
<td class="actions">
|
|
<%= image_link_to t(:delete), 'delete-outline', quantities_path,
|
|
class: 'dangerous',
|
|
onclick: render_turbo_stream('form_destroy_row', {row: row}) %>
|
|
</td>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|