app/components/avo/index/resource_grid_component.html.erb in avo-3.6.4 vs app/components/avo/index/resource_grid_component.html.erb in avo-3.8.0
- old
+ new
@@ -1,16 +1,20 @@
<% if @resources.present? %>
<turbo-frame id="<%= @resource.model_key %>_list" target="_top" class="relative w-full">
- <div class="w-full grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6 mt-8"
- <%= try :drag_reorder_attributes %>
- data-component-name="<%= self.class.to_s.underscore %>"
- data-selected-resources-name="<%= @resource.model_key %>" data-selected-resources="[]">
+ <%= content_tag :div,
+ class:"w-full grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6 mt-8",
+ data: {
+ component_name: self.class.to_s.underscore,
+ selected_resources_name: @resource.model_key,
+ selected_resources: [],
+ **(try(:drag_reorder_data_attributes) || {})
+ } do %>
<% @resources.each_with_index do |resource, index| %>
<% cache_if Avo.configuration.cache_resources_on_index_view, resource.cache_hash(@parent_record) do %>
<%= render(Avo::Index::GridItemComponent.new(resource: resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, actions: actions)) %>
<% end %>
<% end %>
- </div>
+ <% end %>
</turbo-frame>
<% else %>
<div class="bg-white rounded shadow-panel"
data-component-name="<%= self.class.to_s.underscore %>">
<%= helpers.empty_state by_association: params[:related_name].present?, view_type: :grid %>