sanger/sequencescape

View on GitHub
app/views/receptacles/_asset_summary.html.erb

Summary

Maintainability
Test Coverage

<div id="asset-summary" class="asset_summary">
<table class="table">
  <tr>
    <th>Asset name</th>
    <td><%= asset.display_name %></td>
  </tr>
  <tr>
    <th>Asset ID</th>
    <td><%= asset.id.to_s %></td>
  </tr>
  <tr>
    <th>Created at</th>
    <td><%= asset.created_at.to_formatted_s(:day_full_with_time) %></td>
  </tr>
  <tr>
    <th>Type</th>
    <td><%= asset.label %></td>
  </tr>
  <% if asset.is_a?(Lane) %>
    <tr>
    <th>Data to be released externally?</th>
    <td><%= asset.external_release_text %></td>
    </tr>
    <tr>
      <th><%= asset.lane_metadata.attribute_details_for(:release_reason).to_field_info.display_name %></th>
      <td><%= asset.lane_metadata.release_reason %></td>
    </tr>
  <% end %>
  <tr>
    <th>Volume</th>
    <td><%= asset.volume %> &#181l</td>
  </tr>
  <tr>
    <th>Concentration</th>
    <td><%= asset.concentration %> nM</td>
  </tr>
  <% if asset.labware.respond_to?(:human_barcode) %>
    <tr>
      <th>Human barcode</th>
      <td><%= @asset.labware.human_barcode %></td>
    </tr>
  <% end %>
  <% if  @source_plates.present? %>
    <tr>
      <th>Summary page</th>
      <% @source_plates.each do |source_plate| %>
        <td><%= link_to "Summary for #{source_plate.human_barcode}", plate_summary_path(source_plate.human_barcode) %></td>
      <% end %>
    </tr>
  <% end %>
  <% if asset.respond_to?(:plate) %>
    <tr>
      <th>Plate</th>
      <td>
        <% if asset.plate.present? %>
          <%= link_to asset.plate.human_barcode, labware_path(asset.plate) %>
          <%= asset.plate.details %>
        <% else %>
          No plate
        <% end %>
      </td>
    </tr>
  <% elsif asset.respond_to?(:labware) %>
    <tr>
      <th>Labware</th>
      <td>
        <% if asset.labware.present? %>
          <%= link_to asset.labware.display_name, labware_path(asset.labware) %>
          <%= asset.labware.details %>
        <% else %>
          No labware
        <% end %>
      </td>
    </tr>
  <% end %>
  <% if asset.qc_state %>
    <tr>
      <th>QC state</th>
      <td><%= asset.qc_state %></td>
    </tr>
  <% end %>
  <% if asset.respond_to?(:storage_location) && !asset.storage_location.empty? %>
    <tr class="location-service-<%= asset.storage_location_service %>">
      <th>Storage location</th>
      <td><%= asset.storage_location %></td>
    </tr>
  <% end %>
</table>
</div>