<commit_before><% content_for :page_heading do %>
  <h2>
    <%= t('.media_library') %>
  </h2>
<% end %>

<%= form_tag({ action: 'upload' }, { enctype: 'multipart/form-data', class: 'form-inline' }) do %>
  <div class='well well-small'>
    <h3><%= t('.upload_a_file_to_your_site') %></h3>
    <div class="form-group">
      <%= file_field_tag(:upload, class: 'input-file') %>
    </div>
    <div class="form-group">
      <%= submit_tag(t('.upload'), class: 'btn btn-success') %>
    </div>
  </div>
<% end %>

<table class="table table-hover">
  <thead>
    <tr>
      <th><%= t('.filename') %> <small>(<%= t('.right_click_for_link') %>)</small></th>
      <th><%= t('.content_type') %></th>
      <th><%= t('.file_size') %></th>
      <th><%= t('.date') %></th>
    </tr>
  </thead>
  <% if @resources.empty? %>
    <tr>
      <td colspan="6">
        <%= t('.no_resources') %>
      </td>
    </tr>
  <% end %>

  <% for upload in @resources %>
  <tr>
    <td>
      <% if upload.mime =~ /image/ %>
      <a href="<%= upload.upload.medium.url %>" data-toggle="lightbox">
        <%= image_tag(upload.upload.thumb.url) %>
      </a>
      <% else %>
      <%= link_to(upload.upload_url, upload.upload_url) %>
      <% end %>
      <p>
        <small>
          <% if upload.mime =~ /image/ %>
            <%= link_to(t('.thumbnail'), upload.upload.thumb.url) %> |
            <%= link_to(t('.medium_size'), upload.upload.medium.url) %> |
            <%= link_to(t('.original_size'), upload.upload.url) %> |
          <% end %>
          <%= link_to(t('.delete'),
                      { action: 'destroy', id: upload.id, search: params[:search], page: params[:page] },
                      { confirm: t('.are_you_sure'), method: :delete }) %>
        </small>
      </p>
    </td>
    <td>
      <%= upload.mime %>
    </td>
    <td><%= begin
              h upload.size
            rescue StandardError
              0
            end %> bytes</td>
    <td><%= l(upload.created_at, format: :short) %></td>
  </tr>
  <% end %>
  <%= display_pagination(@resources, 6) %>
</table><commit_msg>Force browser to download resources listed in admin<commit_after><% content_for :page_heading do %>
  <h2>
    <%= t('.media_library') %>
  </h2>
<% end %>

<%= form_tag({ action: 'upload' }, { enctype: 'multipart/form-data', class: 'form-inline' }) do %>
  <div class='well well-small'>
    <h3><%= t('.upload_a_file_to_your_site') %></h3>
    <div class="form-group">
      <%= file_field_tag(:upload, class: 'input-file') %>
    </div>
    <div class="form-group">
      <%= submit_tag(t('.upload'), class: 'btn btn-success') %>
    </div>
  </div>
<% end %>

<table class="table table-hover">
  <thead>
    <tr>
      <th><%= t('.filename') %> <small>(<%= t('.right_click_for_link') %>)</small></th>
      <th><%= t('.content_type') %></th>
      <th><%= t('.file_size') %></th>
      <th><%= t('.date') %></th>
    </tr>
  </thead>
  <% if @resources.empty? %>
    <tr>
      <td colspan="6">
        <%= t('.no_resources') %>
      </td>
    </tr>
  <% end %>

  <% for resource in @resources %>
  <tr>
    <td>
      <% if resource.mime =~ /image/ %>
        <a href="<%= resource.upload.medium.url %>" data-toggle="lightbox">
          <%= image_tag(resource.upload.thumb.url) %>
        </a>
      <% else %>
        <%= link_to(resource.upload_url, resource.upload_url, download: resource.upload.identifier) %>
      <% end %>
      <p>
        <small>
          <% if resource.mime =~ /image/ %>
            <%= link_to(t('.thumbnail'), resource.upload.thumb.url) %> |
            <%= link_to(t('.medium_size'), resource.upload.medium.url) %> |
            <%= link_to(t('.original_size'), resource.upload.url) %> |
          <% end %>
          <%= link_to(t('.delete'),
                      { action: 'destroy', id: resource.id, search: params[:search], page: params[:page] },
                      { confirm: t('.are_you_sure'), method: :delete }) %>
        </small>
      </p>
    </td>
    <td>
      <%= resource.mime %>
    </td>
    <td><%= begin
              h resource.size
            rescue StandardError
              0
            end %> bytes</td>
    <td><%= l(resource.created_at, format: :short) %></td>
  </tr>
  <% end %>
  <%= display_pagination(@resources, 6) %>
</table>
{'fraction_non_alphanumeric': 0.23198512319851233, 'fraction_numerical': 0.0032543003254300326, 'mean_word_length': 2.2016369047619047, 'pattern_counts': {'":': 0, '<': 163, '<?xml version=': 0, '>': 163, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2259069', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1482, 'n_words': 280}