sanger/sequencescape

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

Summary

Maintainability
Test Coverage

<% if can? :create, AssetGroup.new(study: @study) %>
  <%- add :menu, "New asset group" => new_study_asset_group_path(@study) -%>
<% end %>
<% if can? :create, Order.new(study: @study) %>
  <% if @study.approved? && @study.active? -%>
    <% add :menu, "Create Submission" => new_submission_path -%>
  <% end -%>
<% end %>
<%- add :menu, "Back to Study" => study_path(@study) -%>

<%= page_title "Asset Groups", @study.name %>

<table class="table table-striped">
  <tr>
    <th width="50%">Asset Group name</th>
    <th width="17%">Print</th>
    <th width="17%">&nbsp;</th>
    <th width="17%">&nbsp;</th>
  </tr>
  <% @asset_groups.each do |asset_group| -%>
    <tr>
      <td><%= link_to asset_group.name, study_asset_group_path(@study, asset_group) %></td>
      <td><%= link_to 'Print labels', print_study_asset_group_path(@study, asset_group) %></td>
      <% if can? :manage, asset_group %>
        <td><%= link_to 'Edit', edit_study_asset_group_path(@study, asset_group) %></td>
        <td><%= link_to 'Destroy', study_asset_group_path(@study, asset_group), confirm: 'Are you sure?', method: :delete %></td>
      <% end %>
    </tr>
  <% end -%>
</table>