sanger/sequencescape

View on GitHub
app/views/labware/_qc_files.html.erb

Summary

Maintainability
Test Coverage
<% if @asset.respond_to?(:qc_files) %>
  <section id="qc_files-table-container" class='info-panel'>
    <header>
      <a href='#qc_files-table-collapser' role="button" data-toggle='collapse'>
      <h3>QC Files
        <%= counter_badge asset.qc_files.size %>
        <small class='show-hide'>Click to toggle</small>
      </h3>
      </a>
    </header>
    <div id="qc_files-table-collapser" class="collapse in show">
      <table id="qc_files-table" class="sortable">
        <thead>
          <tr>
            <th>Filename</th>
            <th>Created at</th>
          </tr>
        </thead>
        <tbody>
          <% @asset.qc_files.each do |file| %>
          <tr>
            <td><%= link_to file.filename, file %></td>
            <td><%= l(file.created_at) %></td>
          </tr>
          <% end %>
        </tbody>
      </table>
    </div>
    <div class="card-body">
      Upload additional QC files. <span class="text-warning">Correctly formatted files will result in the update of volume and concentration information.</span>
      <%= form_for(asset.qc_files.new) do |f| %>
        <%= f.hidden_field :asset_id %>
        <%= f.label :uploaded_data, 'New qc file' %>
        <%= f.file_field :uploaded_data, required: true %>
        <%= f.submit 'Upload file' %>
      <% end %>
    </div>
  </section>
<% end %>