<table class="table table-bordered">
<thead>
  <tr class="table-header">
    <th>Title</th>
    <th>Filename</th>
    <th></th>
  </tr>
</thead>
<% @edition.attachments.each do |attachment| %>
  <tr>
    <td>
      <%= attachment.title %>
    </td>
    <td class="attachment-filename"><%= link_to_attachment(attachment, preview: !@edition.published?, truncate: @edition.imported?, full_url: true) %></td>
    <td class="asset-manager-uploading-status"><%= attachment_uploading_status(attachment) %></td>
    <!--<td><%= attachment_metadata_tag(attachment) %></td>-->
  </tr>
<% end %>
</table>

<table class="table table-bordered">
<thead>
  <tr class="table-header">
    <th>Title</th>
    <th>Filename</th>
    <th></th>
  </tr>
</thead>
<% @edition.attachments.includes(:attachment_data).each do |attachment| %>
  <tr>
    <td>
      <%= attachment.title %>
    </td>
    <td class="attachment-filename"><%= link_to_attachment(attachment, preview: !@edition.published?, truncate: @edition.imported?, full_url: true) %></td>
    <td class="asset-manager-uploading-status"><%= attachment_uploading_status(attachment) %></td>
    <!--<td><%= attachment_metadata_tag(attachment) %></td>-->
  </tr>
<% end %>
</table>

Improve loading attachments for publication
Improve loading attachments for publication

As part of our load testing improvements, we want to make the
publication overview page more resilient.

There are three types of `Attachments`: `FileAttachment`, `HtmlAttachment`,
and `ExternalAttachment`. They all share the same view when loaded
into the publication overview and currently calls the attachments of an
`edition` within the view. Each `attachment` requires it's `attachment_data`,
so including it here should optimise this query.

Co-authored-by: Alan Gabbianelli <321a17de59cb78c00db7c6549ce3de7e3ef94655@digital.cabinet-office.gov.uk>
