<commit_before><h1>Listing records</h1>

<div id='records_nav'>
  <%= form_for(@record_filter, {url: records_path, method: :get}) do |f| %>
    <%= f.collection_select :affiliated_with_project, current_user.projects, :id, :to_s, {include_blank: '--Select a project--'} %>
    <%= f.submit 'Filter records' %>
  <% end %>
</div>

<script>
<%
  dropzone_params = []
  dropzone_params << "'#{request_forgery_protection_token}': '#{form_authenticity_token}'" if protect_against_forgery?
  dropzone_params << "'record[project_affiliated_records_attributes][][project_id]': '#{@project.id}'" if @project
%>
$(function(){
  $(".dropzone").dropzone( {
    params: {
      <%= dropzone_params.join(', ').html_safe %>
    },
    url: '<%= records_path %>',
    method: 'POST',
    paramName: 'record[content]',
    forceFallback: false,
    uploadMultiple: false
  });
});
</script>
<%= 
  content_tag :div, class: 'dropzone' do
    content_tag :div, class: 'fallback' do
      link_to 'New Record', new_record_path
    end
  end if can? :new, Record 
%>
<div id='records'>
<% if @records.empty? %>
<p>There are no records to display.</p>
<% else %>
<%= page_entries_info @records %>
<%= will_paginate @records %>
<table>
  <thead>
    <tr>
<% if current_user %>
      <th>File Name</th>
      <th>Creator</th>
      <th>Content Available</th><commit_msg>Adding code to dropzone to prevent accidental uploads of multiple files. The confirm dialog will appear on uploads of 4 or more files. Files will be removed from the queue if the user hits cancel.<commit_after><h1>Listing records</h1>

<div id='records_nav'>
  <%= form_for(@record_filter, {url: records_path, method: :get}) do |f| %>
    <%= f.collection_select :affiliated_with_project, current_user.projects, :id, :to_s, {include_blank: '--Select a project--'} %>
    <%= f.submit 'Filter records' %>
  <% end %>
</div>

<script>
<%
  dropzone_params = []
  dropzone_params << "'#{request_forgery_protection_token}': '#{form_authenticity_token}'" if protect_against_forgery?
  dropzone_params << "'record[project_affiliated_records_attributes][][project_id]': '#{@project.id}'" if @project
%>
$(function(){
  $(".dropzone").dropzone( {
    autoProcessQueue: false,
    init: function() {
      var the_dz = this;
      var file_count = 0;
      
      the_dz.on("addedfile", function(file) { 
        file_count++;
        var cur_file_num = file_count;
        window.setTimeout(function(){
          if ( cur_file_num == file_count ) {
            if ( file_count < 4 ||
                 confirm("You are about to upload " + file_count + " files. Would you like to continue?") ) {
              the_dz.processQueue();
            }
            else {
              the_dz.removeAllFiles();
            }
            file_count = 0;
          }
        }, 3000);
      });
      the_dz.on("complete", function(file) { 
        the_dz.processQueue();
      });
    },
    params: {
      <%= dropzone_params.join(', ').html_safe %>
    },
    url: '<%= records_path %>',
    method: 'POST',
    paramName: 'record[content]',
    forceFallback: false,
    uploadMultiple: false
  });
});
</script>
<%= 
  content_tag :div, class: 'dropzone' do
    content_tag :div, class: 'fallback' do
      link_to 'New Record', new_record_path
    end
  end if can? :new, Record 
%>
<div id='records'>
<% if @records.empty? %>
<p>There are no records to display.</p>
<% else %>
<%= page_entries_info @records %>
<%= will_paginate @records %>
<table>
  <thead>
    <tr>
<% if current_user %>
      <th>File Name</th>
      <th>Creator</th>
      <th>Content Available</th>
{'fraction_non_alphanumeric': 0.1664355062413315, 'fraction_numerical': 0.00332871012482663, 'mean_word_length': 3.2473498233215548, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 0, '>': 65, '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': '5606838', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1201, 'n_words': 273}