SpeciesFileGroup/taxonworks

View on GitHub
app/views/containers/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :associated do -%>
    <%= on_loan_tag(@container) -%>

    <h3> Container labels</h3>
    <%= @container.print_label || content_tag(:i, 'None.') -%>

    <h3> Nesting containers </h3>
    <% if @container.is_nested? -%>
        <ul>
          <% @container.container_item.ancestors.each do |c| -%>
              <%= content_tag(:li, container_link(c.contained_object)) -%>
          <% end %>
        </ul>
    <% else %>
        <%= content_tag(:em, 'None.') -%>
    <% end %>

    <h3> Contained objects </h3>
    <% if !@container.is_empty? -%>
        <ul>
          <% @container.all_contained_objects.each do |i| -%>
              <%= content_tag(:li, object_link(i)) -%>
          <% end %>
        </ul>
    <% else %>
        <%= content_tag(:em, 'Container is empty.') if @container.container_items.count == 0 -%>
    <% end %>

<% end %>

<%= render(partial: 'shared/data/project/show', locals: {object: @container}) -%>