sanger/sequencescape

View on GitHub
app/views/plates/_qc_table.html.erb

Summary

Maintainability
Test Coverage

<table class="plate" id="<%= qc_type %>">
  <thead>
    <tr>
    <% num_rows = plate.height -%>
    <% num_columns = plate.width -%>
    <th></th>
    <% num_columns.times do |column| -%>
      <th><%= column+1 %></th>
    <% end -%>
    <th class='border' width='2%'class='border' width='2%'></th>
    </tr>
  </thead>
  <tbody>
  <% num_rows.times do |row| -%>
    <tr>
      <% rowchar = (65+row).chr %>
      <td class='border' width='2%'><strong><%= rowchar %></strong></td>
      <% (num_columns).times do |column| -%>
        <% well_name = "#{rowchar}#{column+1}" %>
        <% well = plate.find_well_by_name(well_name) %>
         <% if well %>
            <%= render partial: qc_type, locals: { value: well.qc_result_for(qc_type) } %>
         <% else %>
           <td></td>
        <% end %>
      <% end -%>
      <td class='border' width='2%'><strong><%= rowchar %></strong></td>
    </tr>
  <% end -%>
  <tr>
    <td class='border'></td>
    <% num_columns.times do |column| -%>
      <td class='border'><strong><%= column+1 %></strong></td>
    <% end -%>
    <td class='border' width='2%'class='border' width='2%'></td>
  </tr>
  </tbody>
</table>

<% plate.wells.each do |well| %>
  <label for="well_<%= "#{well.id.to_s}" %>" style="display:none">Well <%= well.map.description %></label>
<% end %>