<div class="table-responsive">
  <table class="table table-hover">
    <thead>
      <tr>
        <th scope="col"><%= _('Template Name') %>&nbsp;<%= paginable_sort_link('templates.title') %></th>
        <th scope="col" class="sorter-false text-center download-column"><%= _('Download') %></th>
        <th scope="col"><%= _('Organisation Name') %>&nbsp;<%= paginable_sort_link('orgs.name') %></th>
        <th scope="col" class="date-column"><%= _('Last Updated') %>&nbsp;<%= paginable_sort_link('templates.updated_at') %></th>
        <th scope="col" class="sorter-false"><%= _('Funder Links') %></th>
        <th scope="col" class="sorter-false" data-toggle="tooltip" title="<%= _('Sample plans are provided by a funder, an organisation or a trusted party.') %>"><%= _('Sample Plans') %><br><small><%= _('(if available)') %></small></th>
      </tr>
    </thead>
    <tbody>
      <% scope.each do |template| %>
        <tr id="<%= dom_id(template) %>">
          <td><%= template.title %></td>
          <td><%= template.org.name %></td>
          <td><%= _(template.org.org_type_to_s) %></td>
          <td><%= raw template.description %></td>
          <td><%= l(template.updated_at.to_date, formats: :short) %></td>
          <td class="text-center">
            <%= link_to template_export_path(template.family_id, format: :docx), target: '_blank' do %>
               <i class="fa fa-file-word-o" aria-hidden="true"></i>
               <em class="sr-only"><%= _('(new window)') %></em>
            <% end %>
            <%= link_to template_export_path(template.family_id, format: :pdf), target: '_blank' do %>
               <i class="fa fa-file-pdf-o" aria-hidden="true"></i>
               <em class="sr-only"><%= _('(new window)') %></em>
            <% end %>
          </td>
          <td><%= template.org.name %></td>
          <td><%= l(template.updated_at.to_date, formats: :short) %></td>
          <td>
            <%= sanitize links_to_a_elements(template.links['funder'], '<br>') %>
          </td>
          <td>
            <%= sanitize links_to_a_elements(template.links['sample_plan'], '<br>') %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>

<%= render 'shared/copy_link_modal' %>
