app/views/administrate/application/_collection.html.erb in administrate-0.1.2 vs app/views/administrate/application/_collection.html.erb in administrate-0.1.3
- old
+ new
@@ -1,70 +1,75 @@
<%#
-# Table
+# Collection
This partial is used on the `index` and `show` pages
to display a collection of resources in an HTML table.
## Local variables:
-- `table_presenter`:
- An instance of [Administrate::Page::Table][1].
- The table presenter uses `ResourceDashboard::TABLE_ATTRIBUTES` to determine
+- `collection_presenter`:
+ An instance of [Administrate::Page::Collection][1].
+ The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine
the columns displayed in the table
- `resources`:
An ActiveModel::Relation collection of resources to be displayed in the table.
By default, the number of resources is limited by pagination
or by a hard limit to prevent excessive page load times
-[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Table
+[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
%>
-<table>
+<table class="collection-data" aria-labelledby="page-title">
<thead>
<tr>
<% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
<th class="cell-label cell-label--<%= attr_type.html_class %>
cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
- ">
+ " scope="col">
<%= link_to(params.merge(
collection_presenter.order_params_for(attr_name)
)) do %>
<%= attr_name.to_s.titleize %>
<% if collection_presenter.ordered_by?(attr_name) %>
<span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
- <%= inline_svg("administrate/sort_arrow.svg") %>
+ <%= svg_tag(
+ "administrate/sort_arrow.svg",
+ "sort_arrow",
+ width: "13",
+ height: "13"
+ ) %>
</span>
<% end %>
<% end %>
</th>
<% end %>
- <th colspan="2"></th>
+ <th colspan="2" scope="col"></th>
</tr>
</thead>
<tbody>
<% resources.each do |resource| %>
<tr class="table__row"
role="link"
tabindex="0"
- data-url="<%= polymorphic_path([Administrate::NAMESPACE, resource]) -%>"
+ data-url="<%= polymorphic_path([namespace, resource]) -%>"
>
<% collection_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],
+ [:edit, namespace, resource],
class: "action-edit",
) %></td>
<td><%= link_to(
t("administrate.actions.destroy"),
- [Administrate::NAMESPACE, resource],
+ [namespace, resource],
class: "table__action--destroy",
method: :delete,
data: { confirm: t("administrate.actions.confirm") }
) %></td>
</tr>