forked from fixin.me/fixin.me
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>
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
<%= tag.tr id: dom_id(unit),
|
|
draggable: true,
|
|
data: {controller: 'drag',
|
|
action: 'dragstart->drag#start dragend->drag#end dragover->drag#over drop->drag#drop dragenter->drag#enter dragleave->drag#leave',
|
|
drag_drag_path_value: rebase_unit_path(unit),
|
|
drag_drop_id_value: dom_id(unit.base || unit),
|
|
drag_drop_id_param_value: 'unit[base_id]'} do %>
|
|
|
|
<td style="--depth:<%= unit.base_id? ? 1 : 0 %>">
|
|
<%= link_to unit, edit_unit_path(unit), class: 'link',
|
|
data: {turbo_stream: true} %>
|
|
</td>
|
|
<td><%= unit.description %></td>
|
|
<td class="ralign"><%= unit.multiplier.to_html %></td>
|
|
|
|
<% if current_user.at_least(:active) %>
|
|
<td class="flex">
|
|
<% unless unit.base_id? %>
|
|
<%= image_link_to t('.new_subunit'), 'plus-outline', new_unit_path(unit),
|
|
id: dom_id(unit, :new, :link), data: {turbo_stream: true} %>
|
|
<% end %>
|
|
|
|
<%= image_button_to_if unit.movable?, t('.destroy'), 'delete-outline', unit_path(unit),
|
|
method: :delete %>
|
|
</td>
|
|
<% if unit.movable? %>
|
|
<td class="handle" draggable="true">⠿</td>
|
|
<% else %>
|
|
<td></td>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|