Sha256: 676198f66e6d19bf44fd72685e6812cb5fc472486bd29fbff4dfabc79db13dc3

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

<%#
# HasMany Show Partial

This partial renders a has_many relationship,
to be displayed on a resource's show page.

By default, the relationship is rendered
as a table of the first few associated resources.
The columns of the table are taken
from the associated resource class's dashboard.

## Local variables:

- `field`:
  An instance of [Administrate::Field::HasMany][1].
  Contains methods to help display a table of associated resources.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
%>

<% if field.resources.any? %>
  <% order = field.order_from_params(params.fetch(field.name, {})) %>
  <% page_number = params.fetch(field.name, {}).fetch(:page, nil) %>
  <%= render(
    "collection",
    collection_presenter: field.associated_collection(order),
    collection_field_name: field.name,
    page: page,
    resources: field.resources(page_number, order),
    table_title: field.name,
  ) %>

  <% if field.more_than_limit? %>
    <span>
      <%= t(
        'administrate.fields.has_many.more',
        count: field.limit,
        total_count: field.data.count,
      ) %>
    </span>
  <% end %>

<% else %>
  <%= t("administrate.fields.has_many.none", default: "–") %>
<% end %>

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
worker-field-nested_has_many-0.7.0 app/views/fields/nested_has_many/_show.html.erb
worker-field-nested_has_many-0.6.0 app/views/fields/nested_has_many/_show.html.erb
worker-field-nested_has_many-0.5.0 app/views/fields/nested_has_many/_show.html.erb
worker-field-nested_has_many-0.4.0 app/views/fields/nested_has_many/_show.html.erb
worker-field-nested_has_many-0.3.0 app/views/fields/nested_has_many/_show.html.erb
worker-field-nested_has_many-0.2.0 app/views/fields/nested_has_many/_show.html.erb
worker-field-nested_has_many-0.1.0 app/views/fields/nested_has_many/_show.html.erb
administrate-field-nested_has_many-1.1.0 app/views/fields/nested_has_many/_show.html.erb