<commit_before><div class="info">
  <%= render_icon('info') %>
  <p><%= _t('explain_upload.intro', name: item_type) %>:</p>
  <ol>
    <li><%= _t('explain_upload.step1', name: item_type) %></li>
    <li><%= _t('explain_upload.step2', name: item_type) %>*</li>
    <li id="explain_step3"><%= _t('explain_upload.step3') %></li>
    <li id="explain_drag_n_drop"><%= _t('explain_upload.dragndrop', name: item_type) %></li>
  </ol>
  <% unless file_types.first == '*' %>
  <p>
    <%= _t('You may upload files with following extensions',
      file_types_description: file_types_description,
      file_types: file_types.to_sentence) %>.
  </p>
  <% end %>
  <small>*<%= _t('explain_upload.footnote', name: item_type) %></small>
</div>

<div class="upload-container">
  <%= label_tag :fileupload, _t(:browse) %>
  <input name="<%= model_name %>[<%= file_attribute %>]" id="fileupload" type="file" multiple value="<%= _t(:browse) %>">
  <div id="dropbox"><%= _t('Or drag files over here') %></div>
</div>

<div class="overall-upload">
  <div class="progress">
    <span class="progress-status">0%</span>
    (<span class="uploaded-files-count">0</span>/<span class="total-files-count">0</span>)
  </div>
</div>

<div id="uploadProgressContainer"></div>

<%- post_params = [
  {name: 'while_assigning', value: !!@while_assigning},
  {name: 'content_id', value: @content.blank? ? nil : @content.id},
  {name: 'element_id', value: @element.blank? ? nil : @element.id},
  {name: 'size', value: @size},
  {name: "#{model_name}[upload_hash]", value: model_name == 'picture' ? Time.now.hash : nil},
  {name: 'options', value: @options ? @options.to_json : nil}
].delete_if { |h| !h.detect { |k, v| v.blank? }.nil? }.to_json -%>

<script type='text/javascript'>
  $(function() {
    var options = {
      post_params: <%= post_params.html_safe %>,
      file_size_limit: <%= configuration(:uploader)['file_size_limit'] || 100 -%>,
      file_types: '<%= file_types.join("|") %>',
      file_types_description: "<%= file_types_description %>",
      file_upload_limit: <%= configuration(:uploader)['upload_limit'] || 50 -%>,
      locale: "<%= ::I18n.locale || 'en' %>",
      complete: function() {
        var url = '<%= redirect_url.html_safe %>';
      <% if @while_assigning %>
        $.get(url, null, null, 'script');
        Alchemy.closeCurrentDialog();
      <% else %>
        Alchemy.pleaseWaitOverlay();
        window.location.href = url;
      <% end %>
      }
    };
    Alchemy.Uploader(options);
  });
</script><commit_msg>Wait 'til the upload dialog is closed before refreshing the archive window. Closes #466<commit_after><div class="info">
  <%= render_icon('info') %>
  <p><%= _t('explain_upload.intro', name: item_type) %>:</p>
  <ol>
    <li><%= _t('explain_upload.step1', name: item_type) %></li>
    <li><%= _t('explain_upload.step2', name: item_type) %>*</li>
    <li id="explain_step3"><%= _t('explain_upload.step3') %></li>
    <li id="explain_drag_n_drop"><%= _t('explain_upload.dragndrop', name: item_type) %></li>
  </ol>
  <% unless file_types.first == '*' %>
  <p>
    <%= _t('You may upload files with following extensions',
      file_types_description: file_types_description,
      file_types: file_types.to_sentence) %>.
  </p>
  <% end %>
  <small>*<%= _t('explain_upload.footnote', name: item_type) %></small>
</div>

<div class="upload-container">
  <%= label_tag :fileupload, _t(:browse) %>
  <input name="<%= model_name %>[<%= file_attribute %>]" id="fileupload" type="file" multiple value="<%= _t(:browse) %>">
  <div id="dropbox"><%= _t('Or drag files over here') %></div>
</div>

<div class="overall-upload">
  <div class="progress">
    <span class="progress-status">0%</span>
    (<span class="uploaded-files-count">0</span>/<span class="total-files-count">0</span>)
  </div>
</div>

<div id="uploadProgressContainer"></div>

<%- post_params = [
  {name: 'while_assigning', value: !!@while_assigning},
  {name: 'content_id', value: @content.blank? ? nil : @content.id},
  {name: 'element_id', value: @element.blank? ? nil : @element.id},
  {name: 'size', value: @size},
  {name: "#{model_name}[upload_hash]", value: model_name == 'picture' ? Time.now.hash : nil},
  {name: 'options', value: @options ? @options.to_json : nil}
].delete_if { |h| !h.detect { |k, v| v.blank? }.nil? }.to_json -%>

<script type='text/javascript'>
  $(function() {
    var options = {
      post_params: <%= post_params.html_safe %>,
      file_size_limit: <%= configuration(:uploader)['file_size_limit'] || 100 -%>,
      file_types: '<%= file_types.join("|") %>',
      file_types_description: "<%= file_types_description %>",
      file_upload_limit: <%= configuration(:uploader)['upload_limit'] || 50 -%>,
      locale: "<%= ::I18n.locale || 'en' %>",
      complete: function() {
        var url = '<%= redirect_url.html_safe %>';
      <% if @while_assigning %>
        Alchemy.closeCurrentDialog(function() {
          $.get(url, null, null, 'script');
        });
      <% else %>
        Alchemy.pleaseWaitOverlay();
        window.location.href = url;
      <% end %>
      }
    };
    Alchemy.Uploader(options);
  });
</script>
{'fraction_non_alphanumeric': 0.21952639751552794, 'fraction_numerical': 0.006017080745341615, 'mean_word_length': 4.027317073170732, 'pattern_counts': {'":': 0, '<': 129, '<?xml version=': 0, '>': 129, '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': '132239', 'n_tokens_mistral': 1940, 'n_tokens_neox': 1826, 'n_words': 350}