<commit_before>$(document).ready(function() {

  $("#images-button").click(function(e) {
    e.preventDefault();

    $("#images-panel").toggle();
  });

  $(".modal-close-button").click(function() {
    $(this).parents(".modal").hide();
  });

  $("body").on("click", ".show-url", (function(e) {
    window.prompt("Copy this URL", $(this).attr("data-url"));
  }));

  $("body").on("click", ".modal .image-upload-button", (function(e) {
    $(".image-upload-form").toggle();
  }));

  $(".modal .image-upload-form").submit(function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();

    var fd = new FormData(this);
    fd.append("label", "WEBUPLOAD");

    $.ajax({
      url: $(this).attr("action"),
      method: "POST",
      data: fd,
      enctype: "multipart/form-data",
      processData: false,
      contentType: false,
      success: function(data) {
        $("#modal-images-table-body").prepend("\
          <tr>\
            <td><img src='"+data.file.preview.url+"'></td>\
            <td>less than a minute ago</td>\
            <td><button class='show-url' data-url='"+data.file.url+"'>Show URL</button></td>\
            <td><a class='image-delete-button' rel='nofollow' href='/admin/images/"+data.id+"'>Destroy</a></td>\
          </tr>\
          ");
      },
      error: function() {
        alert("Create action has failed.");
      }
    });
  });

  $("#modal-images-table-body").on("click", ".image-delete-button", (function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();

    var confirmation = window.confirm("Are you sure?");
    debugger
    if (confirmation) {
      $.ajax({
        url: $(this).attr("href"),
        method: "DELETE",
        success: function() {
          $(this).parents("tr").remove();
        },
        error: function() {
          alert("Delete action has failed.");
        }
      });
    }
  }));

});
<commit_msg>Implement hotfix for image destroy bug<commit_after>$(document).ready(function() {

  $("#images-button").click(function(e) {
    e.preventDefault();

    $("#images-panel").toggle();
  });

  $(".modal-close-button").click(function() {
    $(this).parents(".modal").hide();
  });

  $("body").on("click", ".show-url", (function(e) {
    window.prompt("Copy this URL", $(this).attr("data-url"));
  }));

  $("body").on("click", ".modal .image-upload-button", (function(e) {
    $(".image-upload-form").toggle();
  }));

  $(".modal .image-upload-form").submit(function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();

    var fd = new FormData(this);
    fd.append("label", "WEBUPLOAD");

    $.ajax({
      url: $(this).attr("action"),
      method: "POST",
      data: fd,
      enctype: "multipart/form-data",
      processData: false,
      contentType: false,
      success: function(data) {
        $("#modal-images-table-body").prepend("\
          <tr>\
            <td><img src='"+data.file.preview.url+"'></td>\
            <td>less than a minute ago</td>\
            <td><button class='show-url' data-url='"+data.file.url+"'>Show URL</button></td>\
            <td><a class='image-delete-button' rel='nofollow' href='/admin/images/"+data.id+"'>Destroy</a></td>\
          </tr>\
          ");
      },
      error: function() {
        alert("Create action has failed.");
      }
    });
  });

  $("#modal-images-table-body").on("click", ".image-delete-button", (function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();

    var confirmation = window.confirm("Are you sure?");
    debugger
    if (confirmation) {
      $.ajax({
        url: $(this).attr("href"),
        method: "DELETE"
        // - beware of commas!
        // success: function() {
        //   $(this).parents("tr").remove();
        // },
        // error: function() {
        //   alert("Delete action has failed.");
        // }
      });
      $(this).parents("tr").remove();
    }
  }));

});

{'fraction_non_alphanumeric': 0.23002297676793465, 'fraction_numerical': 0.0, 'mean_word_length': 2.4278215223097113, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '2968305', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1242, 'n_words': 197}