<tr id="<%= dom_id(acquired_media_release) %>">
  <td data-behavior="select"><%= check_box_tag "acquired_media_release_ids[]", acquired_media_release.id, false %></td>
  <td>
    <%= acquired_media_release.name %>
  </td>
  <td>
    <% if acquired_media_release.file_infos.any? %>
      <%= acquired_media_release.file_infos.size %>
    <% else %>
      <%= fa_icon("warning", text: t(".no_media"), class: "text-danger") %>
    <% end %>
  </td>
  <td>
    <%= notes_preview acquired_media_release.notes.order_by_recent %>
  </td>
  <td id="<%= dom_id acquired_media_release, "tags_preview" %>">
    <%= tags_preview acquired_media_release, acquired_media_release.tags %>
  </td>
  <td>
    <%= acquired_media_release.signed_on %>
  </td>
  <td class="text-right">
    <div class="btn-group">
      <%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
      <div class="dropdown-menu dropdown-menu-right">
        <% if policy(Note).new? %>
          <%= link_to fa_icon("sticky-note fw", text: "Notes"), [:new, acquired_media_release, :note], class: "dropdown-item", remote: true %>
        <% end %>
        <% if policy(acquired_media_release.tags).new? %>
          <%= link_to fa_icon("tags fw", text: "Tags"), [:new, acquired_media_release, :acts_as_taggable_on_tag], class: "dropdown-item", remote: true %>
        <% end %>
        <% if policy(acquired_media_release).edit_file_infos? %>
          <%= link_to fa_icon("file fw", text: "Add Media"), [:edit, acquired_media_release, :file_infos], class: "dropdown-item" %>
        <% end %>
        <% if policy(Contract).show? && (acquired_media_release.contract.attached? || acquired_media_release.contract_template.present?) %>
          <%= link_to fa_icon("download fw", text: "Download"), [acquired_media_release, :contracts, format: "pdf"], class: "dropdown-item", target: "_blank" %>
        <% end %>
        <% if policy(acquired_media_release).edit? %>
          <%= link_to fa_icon("pencil fw", text: "Edit"), [:edit, acquired_media_release], class: "dropdown-item" %>
        <% end %>
        <% if policy(acquired_media_release).destroy? %>
          <%= link_to fa_icon("trash fw", text: "Delete"), acquired_media_release, class: "dropdown-item", method: :delete, data: { confirm: "Are you sure?" } %>
        <% end %>
      </div>
    </div>
  </td>
</tr>

