SpeciesFileGroup/taxonworks

View on GitHub
app/views/shared/data/all/batch_file_load/_create.html.erb

Summary

Maintainability
Test Coverage
<h2> Batch create result </h2>
<%= render partial: 'shared/data/all/batch_file_load/import_file_properties' %>

<h3> Files breakdown </h3>
<% if content_for?(:files_breakdown) -%>
    <%= yield :files_breakdown -%>
<% else %>

  <% @result.processed_files[:names].each_with_index do |filename, file_index| %>
    <h4>File <%= file_index + 1 %>: <%= filename %></h4>
    <table class="top_align_text" border="1">
      <tr>
        <th>Count</th>
        <th>Type</th>
        <th>Object</th>
        <th>Validation Errors</th>
      </tr>

      <% object_count = 0 %>

      <% @result.processed_files[:objects][file_index].each do |type, objects| %>
        <% objects.each do |object| %>
          <% object_count += 1 %>

          <tr>
            <td><%= object_count %>
            <td><%= object.class.name.demodulize %></td>
            <td><%= object_link(object) if object.valid? %></td>
            <td><%= object.errors.full_messages.join('; ') %></td>
          </tr>
        <% end %>
      <% end %>
    </table>
  <% end %>
<% end %>

<h3> Input files </h3>
<%= render partial: '/shared/data/all/batch_file_load/input_file' -%>