sanger/sequencescape

View on GitHub
app/views/receptacles/_samples.erb

Summary

Maintainability
Test Coverage

<section id="samples-table"  class='info-panel'>
  <header>
    <a href='#asset-samples-table-collapser' role="button" data-toggle='collapse'>
    <h3>Samples
      <%= counter_badge @asset.aliquots.count %>
      <small class='show-hide'>Click to toggle</small>
    </h3>
    </a>
  </header>
  <div id="asset-samples-table-collapser" class="collapse in show">
    <div class="card-body">
      If the tags below are not correct, you may wish to <%= link_to 'perform tag substitution', new_receptacle_tag_substitution_path(@asset) %>.
    </div>
    <% indexed = @asset.is_a?(AliquotIndexer::Indexable) %>
    <% unless indexed %>
      <%= pagination @aliquots %>
    <% end %>
    <table id="asset-samples-table" class="sortable">
      <colgroup>
        <col class="npg_aliquot_index">
      </colgroup>
      <thead>
        <tr>
          <% if indexed %>
            <th><a>NPG Aliquot Index</a></th>
          <% end %>
          <th><a>Sample Name</a></th>
          <th><a>Sanger Sample Id</a></th>
          <th><a>Tag</a></th>
          <th><a>Tag2</a></th>
        </tr>
      </thead>
      <tbody>
       <% @aliquots.each_with_index do |aliquot, i| %>
       <tr>
         <% if indexed %>
           <td><%= aliquot.aliquot_index.try(:aliquot_index)||'Not Set' %></td>
         <% end %>
         <td><strong><%= link_to(aliquot.sample.name, sample_url(aliquot.sample)) -%></strong></td>
         <td><%= aliquot.sample.sanger_sample_id %></td>
         <td><%= render partial: 'shared/tag_info', locals: {tag: aliquot.tag } if aliquot.tag.present? %></td>
         <td><%= render partial: 'shared/tag_info', locals: {tag: aliquot.tag2 } if aliquot.tag2.present? %></td>
       </tr>
       <% end %>
      </tbody>
    </table>
    <% unless indexed %>
      <%= pagination @aliquots %>
    <% end %>
  </div>
</section>