diff --git a/app/views/administrate/application/_collection.html.erb b/app/views/administrate/application/_collection.html.erb
index 179e6d1b7f..9b12ca88a6 100644
--- a/app/views/administrate/application/_collection.html.erb
+++ b/app/views/administrate/application/_collection.html.erb
@@ -17,44 +17,22 @@ to display a collection of resources in an HTML table.
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
%>
+<%# locals: (collection_presenter:, collection_field_name:, page:, resources:, table_title:, resource_class: nil) %>
- <% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
- | "
- scope="col"
- <% if attr_type.sortable? %>
- aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"
- <% end %>
- >
- <% if attr_type.sortable? %>
- <%= link_to(params: sanitized_order_params(page, collection_field_name).merge(
- collection_presenter.order_params_for(attr_name, key: collection_field_name)
- )) do %>
- <%= t(
- "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
- default: resource_class.human_attribute_name(attr_name).titleize,
- ) %>
- <% if collection_presenter.ordered_by?(attr_name) %>
-
-
-
- <% end %>
- <% end %>
- <% else %>
- <%= t(
- "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
- default: resource_class.human_attribute_name(attr_name).titleize,
- ) %>
- <% end %>
- |
- <% end %>
+ <%= render(
+ partial: 'collection_header_item',
+ layout: 'collection_header_item_layout',
+ collection: collection_presenter.attribute_types.to_a,
+ as: :attribute_type,
+ locals: {
+ collection_presenter: collection_presenter,
+ collection_field_name: collection_field_name,
+ page: page
+ }
+ ) %>
<%= render(
"collection_header_actions",
collection_presenter: collection_presenter,
@@ -66,37 +44,16 @@ to display a collection of resources in an HTML table.
- <% resources.each do |resource| %>
-
- <%= %(tabindex=0 data-url=#{polymorphic_path([namespace, resource])}) %>
- <% end %>
- >
- <% collection_presenter.attributes_for(resource).each do |attribute| %>
- |
- <% if accessible_action?(resource, :show) -%>
-
- <%= render_field attribute %>
-
- <% else %>
- <%= render_field attribute %>
- <% end -%>
- |
- <% 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"
- ) %>
-
- <% end %>
+ <%= render(
+ partial: "collection_item",
+ layout: "collection_item_layout",
+ collection: resources,
+ as: :resource,
+ locals: {
+ collection_presenter: collection_presenter,
+ collection_field_name: collection_field_name,
+ page: page
+ }
+ ) %>
diff --git a/app/views/administrate/application/_collection_field_item.html.erb b/app/views/administrate/application/_collection_field_item.html.erb
new file mode 100644
index 0000000000..6d0b59ce3c
--- /dev/null
+++ b/app/views/administrate/application/_collection_field_item.html.erb
@@ -0,0 +1,12 @@
+<%# locals: (collection_presenter:, collection_field_name:, page:, resource:, attribute:, attribute_counter: nil, attribute_iteration: nil) %>
+
+<% if accessible_action?(resource, :show) -%>
+
+ <%= render_field attribute %>
+
+<% else %>
+ <%= render_field attribute %>
+<% end -%>
diff --git a/app/views/administrate/application/_collection_field_item_layout.html.erb b/app/views/administrate/application/_collection_field_item_layout.html.erb
new file mode 100644
index 0000000000..40663bc733
--- /dev/null
+++ b/app/views/administrate/application/_collection_field_item_layout.html.erb
@@ -0,0 +1,5 @@
+<%# locals: (collection_presenter:, collection_field_name:, page:, resource:, attribute:, attribute_counter: nil, attribute_iteration: nil) %>
+
+
+ <%= yield %>
+ |
diff --git a/app/views/administrate/application/_collection_header_item.html.erb b/app/views/administrate/application/_collection_header_item.html.erb
new file mode 100644
index 0000000000..161e825f4a
--- /dev/null
+++ b/app/views/administrate/application/_collection_header_item.html.erb
@@ -0,0 +1,26 @@
+<%# locals: (collection_presenter:, collection_field_name:, page:, attribute_type:, attribute_type_counter: nil, attribute_type_iteration: nil) %>
+<% attr_name = attribute_type.first %>
+<% attr_type = attribute_type.second %>
+
+<% if attr_type.sortable? %>
+ <%= link_to(params: sanitized_order_params(page, collection_field_name).merge(
+ collection_presenter.order_params_for(attr_name, key: collection_field_name)
+ )) do %>
+ <%= t(
+ "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
+ default: resource_class.human_attribute_name(attr_name).titleize,
+ ) %>
+ <% if collection_presenter.ordered_by?(attr_name) %>
+
+
+
+ <% end %>
+ <% end %>
+<% else %>
+ <%= t(
+ "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
+ default: resource_class.human_attribute_name(attr_name).titleize,
+ ) %>
+<% end %>
diff --git a/app/views/administrate/application/_collection_header_item_layout.html.erb b/app/views/administrate/application/_collection_header_item_layout.html.erb
new file mode 100644
index 0000000000..9e104cba7a
--- /dev/null
+++ b/app/views/administrate/application/_collection_header_item_layout.html.erb
@@ -0,0 +1,15 @@
+<%# locals: (collection_presenter:, collection_field_name:, page:, attribute_type:, attribute_type_counter: nil, attribute_type_iteration: nil) %>
+<% attr_name = attribute_type.first %>
+<% attr_type = attribute_type.second %>
+
+"
+ scope="col"
+ <% if attr_type.sortable? %>
+ aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"
+ <% end %>
+>
+ <%= yield %>
+ |
diff --git a/app/views/administrate/application/_collection_item.html.erb b/app/views/administrate/application/_collection_item.html.erb
new file mode 100644
index 0000000000..abb43ba013
--- /dev/null
+++ b/app/views/administrate/application/_collection_item.html.erb
@@ -0,0 +1,14 @@
+<%# locals: (collection_presenter:, collection_field_name:, page:, resource:, resource_counter:, resource_iteration:) %>
+
+<%= render(
+ partial: "collection_field_item",
+ layout: "collection_field_item_layout",
+ collection: collection_presenter.attributes_for(resource),
+ as: :attribute,
+ locals: {
+ collection_presenter: collection_presenter,
+ collection_field_name: collection_field_name,
+ page: page,
+ resource: resource
+ }
+) %>
diff --git a/app/views/administrate/application/_collection_item_layout.html.erb b/app/views/administrate/application/_collection_item_layout.html.erb
new file mode 100644
index 0000000000..8f9d04d687
--- /dev/null
+++ b/app/views/administrate/application/_collection_item_layout.html.erb
@@ -0,0 +1,19 @@
+<%# locals: (collection_presenter:, collection_field_name:, page:, resource:, resource_counter:, resource_iteration:) %>
+
+
+ <%= %(tabindex=0 data-url=#{polymorphic_path([namespace, resource])}) %>
+ <% end %>
+ >
+
+ <%= yield %>
+
+ <%= render(
+ "collection_item_actions",
+ collection_presenter: collection_presenter,
+ collection_field_name: collection_field_name,
+ page: page,
+ namespace: namespace,
+ resource: resource
+ ) %>
+
diff --git a/app/views/administrate/application/_index_header.html.erb b/app/views/administrate/application/_index_header.html.erb
index 6864669112..3995f73389 100644
--- a/app/views/administrate/application/_index_header.html.erb
+++ b/app/views/administrate/application/_index_header.html.erb
@@ -16,24 +16,7 @@
resource_name: display_resource_name(page.resource_name)
) %>
- <% if filters.any? %>
-
- <% end %>
+ <%= render "search_tooltip", page: page, filters: filters %>
<% end %>
diff --git a/app/views/administrate/application/_search_tooltip.html.erb b/app/views/administrate/application/_search_tooltip.html.erb
new file mode 100644
index 0000000000..61e3c5db68
--- /dev/null
+++ b/app/views/administrate/application/_search_tooltip.html.erb
@@ -0,0 +1,19 @@
+<%# locals: (page:, filters:) %>
+<% return if filters.empty? %>
+
+