-
Notifications
You must be signed in to change notification settings - Fork 1
Admin Helpers and Customizations
Dylan Fisher edited this page Nov 3, 2022
·
2 revisions
If your model has a position
attribute you can enable drag-to-reorder in a Forest table.
<%# views/admin/projects/_table.html.erb %>
<%= content_tag :table, class: 'forest-table table table-striped table-sm', data: { **sortable_table_attributes(records: records, pagy: pagy) } do %>
<thead>
<tr>
<th width="1">Position</th>
</tr>
</thead>
<tbody>
<% records.each do |project| %>
<%= content_tag :tr, data: { **sortable_row_attributes(type_family_group) } do %>
<td><%= sortable_table_field records: records, position: project.position %></td>
<% end %>
<% end %>
</tbody>
</table>