<commit_before><% file = attachment.file %>
<% blob = file.blob %>
<div class="media border bg-light p-2 align-items-center">
  <div class="mr-2" style="width: 3rem">
    <% attachmentable = attachment.attachmentable %>
    <% fancybox_options = attachmentable ? { fancybox: dom_id(attachmentable) } : {} %>
    <% if attachment.image? %>
      <%= link_to url_for(file), target: "_blank", data: fancybox_options do %>
        <div class="embed-responsive embed-responsive-1by1">
          <div class="embed-responsive-item d-flex align-items-center justify-content-center">
            <%= image_tag url_for(file), class: "h-100" %>
          </div>
        </div>
      <% end %>
    <% elsif attachment.video? %>
      <%= link_to url_for(file), target: "_blank", data: fancybox_options do %>
        <div class="embed-responsive embed-responsive-1by1">
          <div class="embed-responsive-item d-flex align-items-center justify-content-center">
            <%= image_tag file.preview(resize: '100'), class: "h-100" %>
          </div>
        </div>
      <% end %>
    <% else %>
      <%= link_to url_for(file), class: "h-100", target: "_blank" do %>
        <div class="embed-responsive embed-responsive-1by1">
          <div class="embed-responsive-item d-flex align-items-center justify-content-center">
            <%= image_tag 'file.png', class: "h-100" %>
          </div>
        </div>
      <% end %>
    <% end %>
  </div>

  <div class="media-body d-flex flex-column">
    <div class="d-flex align-items-center">
      <h4 class="mb-0 d-inline-block"><%= attachment.title %></h4>
      <%= link_to edit_attachment_path(attachment), class: "text-muted mr-auto ml-2", data: { remote: true, type: "xhrml", target: ".media", replace: true } do %>
        <span class="fa fa-pencil-square-o"></span>
      <% end %>
    </div>
    <div class="small d-flex">
      <span class="text-secondary mr-1"><%= number_to_human_size(blob.byte_size, precision: 2, locale: 'en') %></span>
      <%= link_to polymorphic_url(file), class: "clipboard" do %>
        <span class="fa fa-link text-muted"></span>
      <% end %>
      <% data = { remote: true, type: "xhrml", target: ".col-lg-6", replace: true, confirm: "确认删除附件?" } %>
      <%= link_to apply_ok_url([ attachment ]), method: :delete, data: data, class: "text-muted ml-auto" do %><commit_msg>Fix comment image not showing<commit_after><% file = attachment.file %>
<% blob = file.blob %>
<div class="media border bg-light p-2 align-items-center">
  <div class="mr-2" style="width: 3rem">
    <% attachmentable = attachment.attachmentable %>
    <% fancybox_options = attachmentable ? { fancybox: dom_id(attachmentable) } : {} %>
    <% if attachment.image? %>
      <%= link_to url_for(file), target: "_blank", data: fancybox_options do %>
        <div class="embed-responsive embed-responsive-1by1">
          <div class="embed-responsive-item d-flex align-items-center justify-content-center">
            <%= image_tag url_for(file), class: "h-100" %>
          </div>
        </div>
      <% end %>
    <% elsif attachment.video? %>
      <%= link_to url_for(file), target: "_blank", data: fancybox_options do %>
        <div class="embed-responsive embed-responsive-1by1">
          <div class="embed-responsive-item d-flex align-items-center justify-content-center">
            <%= image_tag file.preview(resize: '100'), class: "h-100" %>
          </div>
        </div>
      <% end %>
    <% else %>
      <%= link_to url_for(file), class: "h-100", target: "_blank" do %>
        <div class="embed-responsive embed-responsive-1by1">
          <div class="embed-responsive-item d-flex align-items-center justify-content-center">
            <%= image_tag 'file.png', class: "h-100" %>
          </div>
        </div>
      <% end %>
    <% end %>
  </div>

  <div class="media-body d-flex flex-column">
    <div class="d-flex align-items-center">
      <h4 class="mb-0 d-inline-block"><%= attachment.title.truncate(20) %></h4>
      <%= link_to edit_attachment_path(attachment), class: "text-muted mr-auto ml-2", data: { remote: true, type: "xhrml", target: ".media", replace: true } do %>
        <span class="fa fa-pencil-square-o"></span>
      <% end %>
    </div>
    <div class="small d-flex">
      <span class="text-secondary mr-1"><%= number_to_human_size(blob.byte_size, precision: 2, locale: 'en') %></span>
      <%= link_to polymorphic_url(file), class: "clipboard" do %>
        <span class="fa fa-link text-muted"></span>
      <% end %>
      <% data = { remote: true, type: "xhrml", target: ".col-lg-6", replace: true, confirm: "确认删除附件?" } %>
      <%= link_to apply_ok_url([ attachment ]), method: :delete, data: data, class: "text-muted ml-auto" do %>
{'fraction_non_alphanumeric': 0.18287281164311328, 'fraction_numerical': 0.013499261759122548, 'mean_word_length': 2.9060955518945635, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1768959', 'n_tokens_mistral': 1676, 'n_tokens_neox': 1544, 'n_words': 348}