SpeciesFileGroup/taxonworks

View on GitHub
app/views/sources/batch_load/bibtex/bibtex_batch_create.html.erb

Summary

Maintainability
Test Coverage
<h2> BibTeX Batch Load Sources </h2>

<p> Imported <%= @count -%> records. </p>
<p> Failed to import <%= @sources.count - @count -%> records</p>

<p> <span style='color:green'>Green</span> lines have been imported. If there are soft validation errors
  they will appear below the green line in <span style="color:brown">brown</span>.
  <span style="color:red">Red</span> lines have not been imported and are followed by a list of the associated errors.
</p>

<ol>
  <% @sources.each_with_index do |s, i| %>
      <% if s.valid? %>
          <li>
            <span class='green' ><%= s.cached_string('html').html_safe -%></span>
          <%=   link_to('Edit', edit_source_path(s.metamorphosize)) -%>
          <% if s.soft_validations.messages.count > 0 %>
              <ul>
                <% s.soft_validations.messages.each do |e| %>
                    <%= content_tag(:li, e.to_s.html_safe, class: 'brown') -%>
                <% end %>
              </ul>
          <% end %>
          </li>
      <% else %>
          <%= content_tag(:li, s.cached_string('html').html_safe, class: 'red') -%>
          <ul>
            <% s.errors.messages.each do |e| %>
                <%= content_tag(:li, e.to_s.html_safe) -%>
            <% end %>
          </ul>

      <% end %>
  <% end %>
</ol>