app/views/administrate/application/_collection.html.erb in administrate-0.7.0 vs app/views/administrate/application/_collection.html.erb in administrate-0.8.0

- old
+ new

@@ -16,50 +16,52 @@ or by a hard limit to prevent excessive page load times [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection %> -<table aria-labelledby="page-title"> +<table aria-labelledby="<%= table_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"> + cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>" + scope="col" + role="columnheader" + aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"> <%= link_to(sanitized_order_params.merge( collection_presenter.order_params_for(attr_name) )) do %> <%= t( - "helpers.label.#{resource_name}.#{attr_name}", + "helpers.label.#{collection_presenter.resource_name}.#{attr_name}", default: 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) %>"> - <%= svg_tag( - "administrate/sort_arrow.svg", - "sort_arrow", - width: "13", - height: "13" - ) %> + <svg aria-hidden="true"> + <use xlink:href="#icon-up-caret" /> + </svg> </span> <% end %> <% end %> </th> <% end %> - <% [valid_action?(:edit), valid_action?(:destroy)].count(true).times do %> + <% [valid_action?(:edit, collection_presenter.resource_name), + valid_action?(:destroy, collection_presenter.resource_name)].count(true).times do %> <th scope="col"></th> <% end %> </tr> </thead> <tbody> <% resources.each do |resource| %> <tr class="js-table-row" tabindex="0" - <%= %(role=link data-url=#{polymorphic_path([namespace, resource])}) if valid_action? :show -%> + <% if valid_action? :show, collection_presenter.resource_name %> + <%= %(role=link data-url=#{polymorphic_path([namespace, resource])}) %> + <% end %> > <% collection_presenter.attributes_for(resource).each do |attribute| %> <td class="cell-data cell-data--<%= attribute.html_class %>"> <a href="<%= polymorphic_path([namespace, resource]) -%>" class="action-show" @@ -67,18 +69,18 @@ <%= render_field attribute %> </a> </td> <% end %> - <% if valid_action? :edit %> + <% if valid_action? :edit, collection_presenter.resource_name %> <td><%= link_to( t("administrate.actions.edit"), [:edit, namespace, resource], class: "action-edit", ) %></td> <% end %> - <% if valid_action? :destroy %> + <% if valid_action? :destroy, collection_presenter.resource_name %> <td><%= link_to( t("administrate.actions.destroy"), [namespace, resource], class: "text-color-red", method: :delete,