app/views/administrate/application/_collection.html.erb in administrate-0.16.0 vs app/views/administrate/application/_collection.html.erb in administrate-0.17.0

- old
+ new

@@ -22,11 +22,12 @@ <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) %>" + cell-label--<%= collection_presenter.ordered_html_class(attr_name) %> + cell-label--<%= "#{resource_name}_#{attr_name}" %>" scope="col" role="columnheader" aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"> <%= link_to(sanitized_order_params(page, collection_field_name).merge( collection_presenter.order_params_for(attr_name, key: collection_field_name) @@ -43,14 +44,17 @@ </span> <% end %> <% end %> </th> <% end %> - <% [valid_action?(:edit, collection_presenter.resource_name), - valid_action?(:destroy, collection_presenter.resource_name)].count(true).times do %> - <th scope="col"></th> - <% end %> + <%= render( + "collection_header_actions", + collection_presenter: collection_presenter, + page: page, + resources: resources, + table_title: "page-title" + ) %> </tr> </thead> <tbody> <% resources.each do |resource| %> @@ -72,26 +76,18 @@ <%= render_field attribute %> <% end -%> </td> <% end %> - <% if valid_action? :edit, collection_presenter.resource_name %> - <td><%= link_to( - t("administrate.actions.edit"), - [:edit, namespace, resource], - class: "action-edit", - ) if show_action? :edit, resource%></td> - <% end %> - - <% if valid_action? :destroy, collection_presenter.resource_name %> - <td><%= link_to( - t("administrate.actions.destroy"), - [namespace, resource], - class: "text-color-red", - method: :delete, - data: { confirm: t("administrate.actions.confirm") } - ) if show_action? :destroy, resource %></td> - <% end %> + <%= render( + "collection_item_actions", + collection_presenter: collection_presenter, + collection_field_name: collection_field_name, + page: page, + namespace: namespace, + resource: resource, + table_title: "page-title" + ) %> </tr> <% end %> </tbody> </table>