<commit_before><%= form_for @deposit, url: deposit_path, html: {id: "deposit_main_form"} do |f| %>
    <% if @deposit.errors.any? %>
        <div id="error_explanation">
          <h2><%= pluralize(@deposit.errors.count, "error") %> prohibited this deposit from being saved:</h2>

          <ul>
            <% @deposit.errors.full_messages.each do |message| %>
                <li><%= message %></li>
            <% end %>
          </ul>
        </div>
    <% end %>

    <div class="field">
      <%= f.label 'README' %><br>
      <p>Please provide any information that would help others use the data, for example deployment instructions or required software.</p>
      <p>This information will be stored alongside and made available with your data.</p>
      <%= f.text_area :readme, cols: 100, rows: 6 %>
    </div>
<% end %>
<%= form_for @deposit, url: fileupload_path do |f| %>
    <div class="field">
      <%= f.label "Select local files to deposit" %>&nbsp;
      <%= f.file_field :file, id: "real_file_btn", style: "display: none", multiple: true, class: "file_upload" %><br>
      <button type="button" class="btn btn-large btn-success" id="file_upload_btn">Choose Files</button>
      <span id="file_upload_status">No file chosen</span>
    </div>

    <div class="field">
      <%= f.label "Select a local directory to deposit" %>&nbsp;
      <em>Note: this option only works on certain browsers, including Chrome and Safari</em>
      <%= f.file_field :file, id: "real_dir_btn", style: "display: none", multiple: true, class: "file_upload", directory: true, webkitdirectory: true, mozdirectory: true %><br>
      <button type="button" class="btn btn-large btn-success" id="dir_upload_btn">Choose Directory</button>
      <span id="dir_upload_status">No directory chosen</span>
    </div>

    <div class="field">
      <%= f.label "Select Google Drive files to deposit" %>&nbsp;<br>
      <button type="button" class="btn btn-large btn-success" id="google-drive-btn">Choose Files</button>
      <span id="google_drive_status2">No file chosen</span>
    </div>

    <%= render "formgoogledrive" %>

    <div id="progressbar_container">
      <div id="progressbar_empty" class="progressbar">
        <div id="progressbar_progress">&nbsp;</div>
      </div>
      <div id="progressinfo" class="progressbar">&nbsp;</div>
    </div>
    <div style="clear: both"></div>

    <div class="actions">
      <button type="button" id="submit_btn">Submit</button>
    </div>

<% end %>

<script>
  // this script will use jquery file upload to handle the uploading of files in chunks
  $(function () {
      // by default, if user clicks submit, alert them about no selected files - this will be overridden once they've selected files
      $('#submit_btn').on('click', function (ev) {
        alert("You haven't selected any files to deposit");
      });
      $('.file_upload').fileupload({
          dataType: 'json',
          sequentialUploads: true,
          maxChunkSize: 1000000,
          add: function (e, data) {            
              // pass the webkitRelativePath value (which contains the relative path to the file) to the form handler 
              // so it can build dir structure, and also file actual size
              data.formData = {"path": data.files[0].webkitRelativePath, "size": data.files[0].size};
              // remove previous click handler for submit button (that alerted about no selected files)
              $("#submit_btn").off('click');
              // and add new click handler
              $("#submit_btn").on('click', function (ev) {
                  ev.preventDefault();
                  $(this).attr("disabled", true);
                  $(this).html("Please wait...");
                  data.submit();
              });
          },
          progress: function (e, data) {
              var progress = parseInt(data.loaded / data.total * 100, 10);
              $('#progressbar_progress').css('width', progress + '%');
              $('#progressinfo').html(data.files[0].name + " " + progress + '%');
          },
          done: function (e, data) {
              $("#submit_btn").off('click');
              $.each(data.result.files, function (index, file) {
                  $('#progressinfo').html(file.name + " uploaded!");
              });
              // now that we've uploaded all the files, submit the main form
              //$('#deposit_main_form').submit();
          }
      });
  });
</script>
<commit_msg>re-enabled submit of actual form<commit_after><%= form_for @deposit, url: deposit_path, html: {id: "deposit_main_form"} do |f| %>
    <% if @deposit.errors.any? %>
        <div id="error_explanation">
          <h2><%= pluralize(@deposit.errors.count, "error") %> prohibited this deposit from being saved:</h2>

          <ul>
            <% @deposit.errors.full_messages.each do |message| %>
                <li><%= message %></li>
            <% end %>
          </ul>
        </div>
    <% end %>

    <div class="field">
      <%= f.label 'README' %><br>
      <p>Please provide any information that would help others use the data, for example deployment instructions or required software.</p>
      <p>This information will be stored alongside and made available with your data.</p>
      <%= f.text_area :readme, cols: 100, rows: 6 %>
    </div>
<% end %>
<%= form_for @deposit, url: fileupload_path do |f| %>
    <div class="field">
      <%= f.label "Select local files to deposit" %>&nbsp;
      <%= f.file_field :file, id: "real_file_btn", style: "display: none", multiple: true, class: "file_upload" %><br>
      <button type="button" class="btn btn-large btn-success" id="file_upload_btn">Choose Files</button>
      <span id="file_upload_status">No file chosen</span>
    </div>

    <div class="field">
      <%= f.label "Select a local directory to deposit" %>&nbsp;
      <em>Note: this option only works on certain browsers, including Chrome and Safari</em>
      <%= f.file_field :file, id: "real_dir_btn", style: "display: none", multiple: true, class: "file_upload", directory: true, webkitdirectory: true, mozdirectory: true %><br>
      <button type="button" class="btn btn-large btn-success" id="dir_upload_btn">Choose Directory</button>
      <span id="dir_upload_status">No directory chosen</span>
    </div>

    <div class="field">
      <%= f.label "Select Google Drive files to deposit" %>&nbsp;<br>
      <button type="button" class="btn btn-large btn-success" id="google-drive-btn">Choose Files</button>
      <span id="google_drive_status2">No file chosen</span>
    </div>

    <%= render "formgoogledrive" %>

    <div id="progressbar_container">
      <div id="progressbar_empty" class="progressbar">
        <div id="progressbar_progress">&nbsp;</div>
      </div>
      <div id="progressinfo" class="progressbar">&nbsp;</div>
    </div>
    <div style="clear: both"></div>

    <div class="actions">
      <button type="button" id="submit_btn">Submit</button>
    </div>

<% end %>

<script>
  // this script will use jquery file upload to handle the uploading of files in chunks
  $(function () {
      // by default, if user clicks submit, alert them about no selected files - this will be overridden once they've selected files
      $('#submit_btn').on('click', function (ev) {
        alert("You haven't selected any files to deposit");
      });
      $('.file_upload').fileupload({
          dataType: 'json',
          sequentialUploads: true,
          maxChunkSize: 1000000,
          add: function (e, data) {            
              // pass the webkitRelativePath value (which contains the relative path to the file) to the form handler 
              // so it can build dir structure, and also file actual size
              data.formData = {"path": data.files[0].webkitRelativePath, "size": data.files[0].size};
              // remove previous click handler for submit button (that alerted about no selected files)
              $("#submit_btn").off('click');
              // and add new click handler
              $("#submit_btn").on('click', function (ev) {
                  ev.preventDefault();
                  $(this).attr("disabled", true);
                  $(this).html("Please wait...");
                  data.submit();
              });
          },
          progress: function (e, data) {
              var progress = parseInt(data.loaded / data.total * 100, 10);
              $('#progressbar_progress').css('width', progress + '%');
              $('#progressinfo').html(data.files[0].name + " " + progress + '%');
          },
          done: function (e, data) {
              $("#submit_btn").off('click');
              $.each(data.result.files, function (index, file) {
                  $('#progressinfo').html(file.name + " uploaded!");
              });
              // now that we've uploaded all the files, submit the main form
              $('#deposit_main_form').submit();
          }
      });
  });
</script>

{'fraction_non_alphanumeric': 0.15491702862234102, 'fraction_numerical': 0.004900322975832498, 'mean_word_length': 2.5050741608118656, 'pattern_counts': {'":': 4, '<': 147, '<?xml version=': 0, '>': 147, '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': '348761', 'n_tokens_mistral': 2666, 'n_tokens_neox': 2511, 'n_words': 744}