Current section

Files

Jump to
kaffy lib kaffy_web templates resource _table.html.eex
Raw

lib/kaffy_web/templates/resource/_table.html.eex

<table class="table table-striped">
<thead>
<%= render KaffyWeb.ResourceView, "_table_header.html", my_resource: @my_resource, fields: @fields, params: @params %>
</thead>
<tbody>
<%= for {entry, index} <- Enum.with_index(@entries) do %>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input select-item kaffy-resource-checkbox" id="kaffy-select-<%= index %>" name="resource" value="<%= Kaffy.ResourceAdmin.serialize_id(@my_resource, entry) %>"/>
<label class="custom-control-label" for="kaffy-select-<%= index %>"></label>
</div>
</td>
<%= for {field, index} <- Enum.with_index(@fields) do %>
<%= if index == 0 do %>
<td><%= link Kaffy.ResourceSchema.kaffy_field_value(@conn, entry, field), to: Kaffy.Utils.router().kaffy_resource_path(@conn, :show, @context, @resource, Kaffy.ResourceAdmin.serialize_id(@my_resource, entry)) %></td>
<% else %>
<td><%= Kaffy.ResourceSchema.kaffy_field_value(@conn, entry, field) %></td>
<% end %>
<% end %>
</tr>
<% end %>
</tbody>
</table>