fixin.me/app/views/units/_form.html.erb
cryptogopher 7962cdf169 Simplify object and association checks
* check for <object> instead of <object>.nil?
* check for <association>_id? instead of <association>.nil? (avoids
  record loading)
2025-01-16 20:42:18 +01:00

23 lines
840 B
Plaintext

<%= tabular_fields_for @unit, form: form_tag do |form| %>
<%- tag.tr id: row, class: "form", onkeydown: "processKey(event)",
data: {link: link, form: form_tag, hidden_row: hidden_row} do %>
<td class="<%= class_names({subunit: @unit.base_id?}) %>">
<%= form.text_field :symbol, required: true, autofocus: true, size: 12 %>
</td>
<td>
<%= form.text_area :description, cols: 30, rows: 1, escape: false %>
</td>
<td class="number">
<%= form.number_field :multiplier, required: true, size: 10, min: :step if @unit.base_id? %>
</td>
<td class="actions">
<%= form.button %>
<%= image_link_to t(:cancel), "close-outline", units_path, class: 'dangerous',
name: :cancel, onclick: render_turbo_stream('form_close', {row: row}) %>
</td>
<td></td>
<% end %>
<% end %>