sanger/sequencescape

View on GitHub
app/views/shared/_batch.html.erb

Summary

Maintainability
Test Coverage

<table  id="batch-<%= edit ? 'edit' : 'show' %>"
        class="table"
        data-batch-id="<%= @batch&.id %>">
  <thead>
    <tr>
      <% if stage %>
        <th class="nosort" width="7%"><input type='checkbox' class='select_all'></th>
      <% end -%>
      <th>Position</th>
      <th>Sample</th>
      <th>Request</th>
      <th>Source</th>
      <th>Source barcode</th>
      <th>Target Type</th>

      <th>Target barcode</th>
      <% @rits.each do |rit| %>
        <th><%= rit.label %></th>
      <% end %>
      <th>State</th>
      <th>Comments</th>
    </tr>
  </thead>
  <tbody id="requests_list">
    <% requests.each_with_index do |request, i| -%>
      <tr id="request_<%= request.id %>" class="row<%= i %>" data-request-id="<%= request.id %>">

        <% if stage %>
            <td><input name='request[<%= request.id %>]' id="sample-<%= i+1  %>-checkbox" class='sample_check select_all_target' value="on" type='checkbox' checked></td>
        <% end -%>

        <td><%= request.position %></td>
        <td><%= request.asset&.display_name %></td>
        <td><%= link_to request.id, request_url(request) %></td>

        <% if request.asset  %>
          <td><%= link_to request.asset.sti_type, receptacle_path(request.asset) %></td>
          <td><%= request.asset.try(:human_barcode) %></td>
        <% else %>
          <td></td>
          <td></td>
        <% end %>

        <% if request.target_asset %>
          <td><%= link_to request.target_asset.sti_type, receptacle_path(request.target_asset) %></td>
          <td><%= request.target_asset.try(:human_barcode) %></td>
        <% else %>
          <td></td>
          <td></td>
        <% end %>

        <% @rits.each do |rit| %>
          <td><%= rit.value_for(request, @batch) %></td>
        <% end %>

        <td><%= request.state.humanize %></td>
        
        <td><%= link_to (pluralize Request.get_all_comments(request), 'comment'),  request_comments_url(request) %></td>

      </tr>
    <% end -%>
  </tbody>
</table>