<%# Display post information with associated details %>
<div class="d-flex align-items-center gap-2">
  <div class="d-flex align-items-center gap-2">
    <%= link_to Rails.application.routes.url_helpers.domain_post_path(post),
                class: "badge bg-primary",
                target: "_blank" do %>
      <i class="fa-solid fa-image me-1"></i><%= post.class.name %> #<%= post.id %>
    <% end %>
    <% attr = post.class.param_prefix_and_attribute[1]%>
    <span class="badge bg-secondary text-truncate" title="<%= post.send(attr) %>">
      <i class="fa-solid fa-tag me-1"></i><%= attr %>:<%= post.send(attr) %>
    </span>
    <% if post.title.present? %>
      <span class="badge bg-secondary text-truncate" title="<%= post.title %>">
        <i class="fa-solid fa-heading me-1"></i><%= post.title %>
      </span>
    <% end %>
  </div>
  <div class="d-flex align-items-center ms-auto gap-2">
    <% if post.respond_to?(:status_for_view) %>
      <span class="badge bg-secondary text-truncate">
        <i class="fa-solid fa-circle-check me-1"></i><%= post.status_for_view %>
      </span>
    <% end %>
    <% if post.external_url_for_view.present? %>
      <%= link_to post.external_url_for_view.to_s,
                  class: "badge bg-secondary text-truncate-link",
                  target: "_blank",
                  rel: "noopener noreferrer nofollow" do %>
        <i class="fa-solid fa-link me-1"></i><%= domain_abbreviation_for_model(post) %>
      <% end %>
    <% end %>
    <% if post.primary_creator_for_view.present? %>
      <span class="badge bg-info">
        <i class="fa-solid fa-user me-1"></i><%= post.primary_creator_for_view.name %>
      </span>
    <% elsif post.primary_creator_name_fallback_for_view.present? %>
      <span class="badge bg-info">
        <i class="fa-solid fa-user me-1"></i><%= post.primary_creator_name_fallback_for_view %>
      </span>
    <% end %>
    <% if post.num_favorites_for_view.present? %>
      <span class="badge bg-light text-dark">
        <i class="fa-solid fa-star me-1"></i><%= post.num_favorites_for_view %>
      </span>
    <% end %>
    <% if log_entry = post.scanned_post_log_entry_for_view %>
      <%= link_to Rails.application.routes.url_helpers.log_entry_path(log_entry),
                  class: "badge bg-secondary",
                  target: "_blank" do %>
        <i class="fa-solid fa-file-lines me-1"></i>HttpLogEntry #<%= log_entry.id %>
      <% end %>
    <% end %>
    <% if post.posted_at.present? %>
      <span class="badge bg-light text-dark" title="<%= time_ago_in_words(post.posted_at) %> ago">
        <i class="fa-regular fa-clock me-1"></i><%= post.posted_at.strftime("%Y-%m-%d %H:%M:%S") %>
      </span>
    <% end %>
    <% if post.file_downloaded_at.present? %>
      <span class="badge bg-success">
        <i class="fa-solid fa-download me-1"></i>Downloaded
      </span>
    <% end %>
    <% if primary_file = post.primary_file_for_view %>
      <% if primary_file.blob.present? %>
        <span class="badge bg-light text-dark">
          <i class="fa-solid fa-file-arrow-down me-1"></i>SHA256: <%= HexUtil.bin2hex(primary_file.blob_sha256[0..7]) %>
        </span>
      <% end %>
    <% end %>
  </div>
</div>
<% if post.description_for_view.present? %>
  <div class="mt-2">
    <small class="text-muted"><%= truncate(post.description_for_view, length: 200) %></small>
  </div>
<% end %>
