<% # locals: { # table: "instance of Plutonium::UI::Builder::Collection" # } resource_class = table.resource_class resources = table.records.to_a record_actions = table.actions.collection_record_actions search_object = table.search_object %>
<% unless resources.any? %>
<%= render 'empty_card', message: "You have no #{resource_name_plural(resource_class).downcase}" do if policy(resource_class).create? link_to "Create #{resource_name(resource_class)}", adapt_route_args(resource_class, action: :new), class: 'btn btn-outline-primary' end end %>
<% else %>
<% table.fields.each do |name, field| %> <% end %> <% resources.each do |resource| %> <% table.fields.each do |name, field| %> <% options = field.options max_width = options.delete :pu_max_width %> <% end %> <% end %>
<%= sort_link(search_object, :id, '#', class: "text-decoration-none") %> <% if resource_class.ransortable_attributes.include? name.to_s %> <%= sort_link(search_object, name, field.label, class: "text-decoration-none") %> <% else %> <%= field.label %> <% end %> Actions
<% if policy(resource).show? %> <%= link_to resource.to_param, adapt_route_args(resource), class: "text-decoration-none" %> <% else %> <%= resource.to_param %> <% end %> <%= field.render self, resource %> <%= render partial: 'table_actions', locals: { actions: record_actions.permitted_for(policy(resource)), resource: resource } %>
<% if table.pagination.present? %>
<%= render 'pagination', pagination: table.pagination %>
<% end %> <% end %>