Replace patched #dom_id with #dom_target

This commit is contained in:
2026-10-17 04:57:26 +02:00
parent f1578fad75
commit 2c845f3528
14 changed files with 45 additions and 60 deletions
+16 -16
View File
@@ -1,32 +1,32 @@
<%= tag.tr id: dom_id(unit),
ondragstart: "dragStart(event)", ondragend: "dragEnd(event)",
ondragover: "dragOver(event)", ondrop: "drop(event)",
ondragenter: "dragEnter(event)", ondragleave: "dragLeave(event)",
data: {drag_path: rebase_unit_path(unit),
drop_id: dom_id(unit.base || unit),
drop_id_param: "unit[base_id]"} do %>
<tr id="<%= dom_target(unit) %>"
ondragstart="dragStart(event)" ondragend="dragEnd(event)"
ondragover="dragOver(event)" ondrop="drop(event)"
ondragenter="dragEnter(event)" ondragleave="dragLeave(event)"
data-drag-path="<%= rebase_unit_path(unit) %>"
data-drop-id="<%= dom_target(unit.base || unit) %>"
data-drop-id-param="<%= field_name(:unit, :base_id) %>">
<td style="--depth:<%= unit.base_id? ? 1 : 0 %>">
<%= link_to unit, edit_unit_path(unit), class: 'link', onclick: 'this.blur();',
data: {turbo_stream: true} %>
</td>
<td><%= unit.description %></td>
<td><%= unit.description %>
<%# Closing <td> tag required to avoid whitespace inclusion for testing. %>
<td class="ralign"><%= unit.multiplier.to_html if unit.base_id? %></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), onclick: 'this.blur();', data: {turbo_stream: true} %>
id: dom_target(:new, unit, :link), onclick: 'this.blur();',
data: {turbo_stream: true} %>
<% end %>
<%= image_button_to_if unit.movable?, t('.destroy'), 'delete-outline', unit_path(unit),
method: :delete %>
</td>
<%= image_button_to_if unit.movable?, t('.destroy'), 'delete-outline',
unit_path(unit), method: :delete %>
<% if unit.movable? %>
<td class="handle" draggable="true">&#x283F</td>
<td class="handle" draggable="true">&#x283F
<% else %>
<td></td>
<td>
<% end %>
<% end %>
<% end %>
+1 -1
View File
@@ -1,7 +1,7 @@
<div class="rightside-area buttongrid">
<% if current_user.at_least(:active) %>
<%= image_link_to t('.new_unit'), 'plus-outline', new_unit_path,
id: dom_id(Unit, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>
id: :new_unit_link, onclick: 'this.blur();', data: {turbo_stream: true} %>
<% end %>
<%= image_link_to t('.import_units'), 'download-outline', default_units_path,
class: 'tools-area' %>