sanger/sequencescape

View on GitHub
app/views/studies/samples/index.html.erb

Summary

Maintainability
Test Coverage

<%- add :about, I18n.t("studies.about") %>
<%- add :back_menu, I18n.t("navigation.menu.back_to_study") => study_path(@study) -%>

<div class="page-header"><h1><%= @study.name %> : Samples</h1></div>
<div class='subtitle'>
  Study <%= @study.id %> &middot; Created on <%= @study.created_at.to_formatted_s(:long) %> &middot; <%= @study.state.capitalize %>
</div>



<% if @samples.size > 0 %>
  <header>
    <h3>Samples
      <%= counter_badge @study.samples.count %>
    </h3>
  </header>
  <%= pagination @samples %>
  <table cellpadding="4" cellspacing="0" width="100%" class="sortable">
    <thead>
      <tr>
        <th width="10%">ID</th>
        <th>Sample Name</th>
      </tr>
    </thead>
    <tbody>
    <% @samples.each do |sample| -%>
      <tr class="<%= cycle("rowodd", "roweven") %><%= " withdrawn" if sample.consent_withdrawn? %>">
        <td><%= link_to sample.id, sample_path(sample) %></td>
        <td><%= sample.name %><%= " - Consent withdrawn" if sample.consent_withdrawn? %></td>
      </tr>
    <% end %>
    </tbody>
  </table>
  <%= pagination @samples %>
<% else %>
  <% if can? :create, SampleManifest -%>
    <%= display_user_guide(I18n.t('studies.samples.no_samples_registered'), sample_manifests_study_path(@study)) %>
  <% end -%>
<% end %>