1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00
danbarberphoto/app/views/admin/photos/_table.html.erb
Dan Barber 1f35c7210e Customise administrate
We've added some custom field types for dragonfly images,
text fields and markdown fields.
2015-10-26 14:26:32 +00:00

55 lines
1.7 KiB
Plaintext

<table>
<thead>
<tr>
<% table_presenter.attribute_types.each do |attr_name, attr_type| %>
<th class="cell-label cell-label--<%= attr_type.html_class %>
cell-label--<%= table_presenter.ordered_html_class(attr_name) %>
">
<%= link_to(params.merge(
table_presenter.order_params_for(attr_name)
)) do %>
<%= attr_name.to_s.titleize %>
<% if table_presenter.ordered_by?(attr_name) %>
<span class="cell-label__sort-indicator cell-label__sort-indicator--<%= table_presenter.ordered_html_class(attr_name) %>">
<%= inline_svg("administrate/sort_arrow.svg") %>
</span>
<% end %>
<% end %>
</th>
<% end %>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% resources.each do |resource| %>
<tr class="table__row"
role="link"
tabindex="0"
data-url="<%= polymorphic_path([Administrate::NAMESPACE, resource]) -%>"
>
<% table_presenter.attributes_for(resource).each do |attribute| %>
<td class="cell-data cell-data--<%= attribute.html_class %>">
<%= render_field attribute %>
</td>
<% end %>
<td><%= link_to(
t("administrate.actions.edit"),
[:edit, Administrate::NAMESPACE, resource],
class: "action-edit",
) %></td>
<td><%= link_to(
t("administrate.actions.destroy"),
[Administrate::NAMESPACE, resource],
class: "table__action--destroy",
method: :delete,
data: { confirm: t("administrate.actions.confirm") }
) %></td>
</tr>
<% end %>
</tbody>
</table>