Sha256: 7d160f361613536587fe8d245dac6e7d1932b4df7fccd1963bc02b053f19df55

Contents?: true

Size: 1.19 KB

Versions: 9

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

9 entries across 9 versions & 1 rubygems

Version Path
viniBaxter-spa-nested_has_many-300.0.6 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-300.0.5 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-300.0.4 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-300.0.2 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-300.0.1 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-5.4.0 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-5.0.1 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-5.0.0 app/views/fields/nested_has_many/_show_current.html.erb
viniBaxter-spa-nested_has_many-4.0.0 app/views/fields/nested_has_many/_show_current.html.erb