sanger/sequencescape

View on GitHub
app/views/plate_summaries/_descendant.html.erb

Summary

Maintainability
Test Coverage
<%= bs_custom_panel(:info, :table, {class: 'table table-summary'}, {title: "#{descendant.human_barcode} - #{descendant.purpose.name}"}) do %>
  <tr>
    <th>
      Machine barcode
    </th>
    <td>
      <%= link_to descendant.machine_barcode, labware_path(descendant) %>
    </td>
  </tr>
  <tr>
    <th>
      Created
    </th>
    <td>
      <% descendant.try(:plate_creations)&.each do |plate_creation| %>
        <%= plate_creation.created_at %>
        <%= plate_creation.user.try(:name) %>
      <% end %>
    </td>
  </tr>
  <% descendant.state_changes.each do |state_change| %>
    <tr>
      <th>
        <%= state_change.previous_state %> → <%= state_change.target_state %>
      </th>
      <td>
          <%= state_change.created_at %>
          <%= state_change.user.try(:name) %></br>
          <%= state_change.reason %>
      </td>
    </tr>
  <% end %>
  <% descendant.try(:tag_layouts)&.each do |tag_layout| %>
    <tr>
      <th>
        Tagged with <%= tag_layout.tag_group.name %>
      </th>
      <td>
          <%= tag_layout.created_at %>
          <%= tag_layout.user.try(:name) %>
      </td>
    </tr>
  <% end %>
  <% descendant.qc_files.each do |qc_file| %>
    <tr>
      <th>
        <%= qc_file.filename %>
      </th>
      <td>
        <%= link_to "Download", qc_file_path(qc_file) %>
      </td>
    </tr>
  <% end %>
  <% if descendant.custom_metadatum_collection.present?%>
    <tr>
      <th>
        Metadata
      </th>
      <td>
        <ul class="list-unstyled">
          <% descendant.metadata.each do |k, v| %>
            <li><%= "#{k} : #{v}" %></li>
          <%end%>
        </ul>
      </td>
    </tr>
  <% end %>
<% end %>