sanger/sequencescape

View on GitHub
app/views/gels/_gel_plate.html.erb

Summary

Maintainability
Test Coverage

<%# This partial renders a gel QC form for a 96 well plate. %>
<h2>Plate <%= plate.human_barcode %></h2>

<table class="new-plate">
  <thead>
    <th>&nbsp;</th>
    <% (1..12).each do |column| -%>
      <th><%= column %></th>
    <% end -%>
  </thead>
  <tbody>
    <% ('A'..'H').each do |row| -%>
      <tr>
        <th><%= row %></th>
        <% (1..12).each do |column| -%>
            <% well_name = "#{row}#{column}" %>
            <% well = plate.find_well_by_name(well_name) %>
          <td>
            <%# The well element is used inside the cell to correctly force the cell size.
                It's part of the plate regardless of whether it's empty or not.  %>
            <div class="well">
              <% if well.present? %>
                <% sample = well.try(:primary_aliquot).try(:sample) %>
                <% if sample.present? and not sample.sample_empty? %>
                  <%= hidden_label_tag_for_testing(well_name.downcase, "Well #{well_name}") %>
                  <%= gel_qc_select_box(well, well.well_attribute.gel_pass, generate_blank: true, id: well_name.downcase) %>
                <% end %>
              <% end %>
            </div>
          </td>
        <% end -%>
      </tr>
    <% end -%>
  </tbody>

</table>