<commit_before>Dropzone.autoDiscover = false;

$(document).on('turbolinks:load', function() {
  $('form.dropzone').dropzone({
    acceptedFiles: 'image/*',
    parallelUploads: 2,
    paramName: 'picture[image]'
  });

  $('#gallery').justifiedGallery({
    waitThumbnailsLoad: false,
    captions: false,
    rowHeight: 200,
    maxRowHeight: 250,
    lastRow: 'nojustify',
    margins: 10,
    border: 0
  });

  $("input:file").change(function() {
    var f = this.files;
    var n = this.files.length;
    var msg = n > 1 ? n + " files selected" : f[0].name;

    if (this.id) {
      $(".custom-file-label[for=" + this.id + "]").text(msg);
    }
  });


  var busy = false;
<commit_msg>Replace thumbnail preview by image on successful upload<commit_after>Dropzone.autoDiscover = false;

$(document).on('turbolinks:load', function() {
  $('form.dropzone').dropzone({
    acceptedFiles: 'image/*',
    parallelUploads: 2,
    paramName: 'picture[image]',
    init: function() {
      this.on('success', function(file, res) {
        var image = res.image_filename;
        var url = res.image.url.replace(image, '120x120!/' + image);

        this.emit('thumbnail', file, url);
        this.createThumbnailFromUrl(file, url);
      });
    }
  });

  $('#gallery').justifiedGallery({
    waitThumbnailsLoad: false,
    captions: false,
    rowHeight: 200,
    maxRowHeight: 250,
    lastRow: 'nojustify',
    margins: 10,
    border: 0
  });

  $("input:file").change(function() {
    var f = this.files;
    var n = this.files.length;
    var msg = n > 1 ? n + " files selected" : f[0].name;

    if (this.id) {
      $(".custom-file-label[for=" + this.id + "]").text(msg);
    }
  });


  var busy = false;

{'fraction_non_alphanumeric': 0.17815420560747663, 'fraction_numerical': 0.017523364485981307, 'mean_word_length': 2.9288990825688073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4492820', 'n_tokens_mistral': 633, 'n_tokens_neox': 598, 'n_words': 123}