table.table
  thead
    tr
      th Thing
      th Reason
      th User
      th.hide-mobile Opened
      th State
      th Options
  tbody
    = for report <- @reports do
      tr
        td
          => reported_image @conn, report.reportable
          = link_to_reported_thing report.reportable
        td
          span title=report.reason
            = truncate(report.reason)
        td
          = if report.user do
            = link report.user.name, to: ~p"/profiles/#{report.user}"
          - else
            em>
              = truncated_ip_link(report.ip)
            = link_to_fingerprint(@conn, report.fingerprint)

          = if not is_nil(report.user) and Enum.any?(report.user.linked_tags) do
            = render PhilomenaWeb.TagView, "_tag_list.html", tags: ordered_tags(report.user.linked_tags), conn: @conn

        td.hide-mobile
          = pretty_time report.created_at

        td class=report_row_class(report)
          => pretty_state(report)
          = user_abbrv report.admin
        td
          => link "Show", to: ~p"/admin/reports/#{report}"

          = if report.open do
            = if report.user do
              ' &bull;
              => link "Send PM", to: ~p"/conversations/new?#{[recipient: report.user.name]}"

            = if is_nil(report.admin) and not current?(report.admin, @conn.assigns.current_user) do
              ' &bull;
              => link "Claim", to: ~p"/admin/reports/#{report}/claim", data: [method: "post"]

            = if current?(report.admin, @conn.assigns.current_user) do
              ' &bull;
              => link "Release", to: ~p"/admin/reports/#{report}/claim", data: [method: "delete"]

            ' &bull;
            => link "Close", to: ~p"/admin/reports/#{report}/close", data: [method: "post", confirm: "Are you really, really sure?"]
