<commit_before>$(function() {
  $('#deleteGPtModal').on('shown.bs.modal', function () {
    $('#myInput').focus()
  });

// Show Add Godparent button when selecting "Has Godparent"
$(document).ready (function () {
    let gpselect = $('#godparent_status_chosen a span').text();
    if (gpselect == 'Has godparent' && (!$('#addgpbutton').length)) {
    $('#guardian').append('<p><button type="button" id="addgpbutton" class="btn btn-sm btn-success" data-toggle="modal" data-target="#godparentModal"> Add Godparent </button></p>');
    } 
  });

$('#godparent_status_chosen').on('click', function() {
  let gpselect = $('#godparent_status_chosen a span').text();
  if (gpselect == 'Has godparent' && (!$('#addgpbutton').length)) {
    $('#guardian').append('<p><button type="button" id="addgpbutton" class="btn btn-sm btn-success" data-toggle="modal" data-target="#godparentModal"> Add Godparent </button></p>');
  } 
  
});


// Retrieve godparent id from clicking list point
  $('#godparents_list i').on('click', function(e) {
    godparent_id = $(e.target).attr('data-id');
  });
  
// Delete godparent when confirming delete godparent warning modal
  $('#deleteGodparentForm').on('submit', function(e) {
    e && e.preventDefault();

    var data = {
      _csrf_token: $('#deleteGodparentForm input[name="_csrf_token"]').val(),
      godparent_id: godparent_id,
    };

    $.ajax({
      type: 'POST',
      url: '/delete-godparent/' + godparent_id,
      contentType: 'application/json',
      headers: {
        'X-CSRFToken': data._csrf_token,
      },
      success: function(response) {
        $("#deleteGodparentModalBody").html( "<p>Godparent deleted!</p>" );
        $("#deleteModalLabel").html( "DELETED" );<commit_msg>remove add godparent button if selection isn't has godparent<commit_after>$(function() {
  $('#deleteGPtModal').on('shown.bs.modal', function () {
    $('#myInput').focus()
  });

// Show Add Godparent button when selecting "Has Godparent"
$(document).ready (function () {
    let gpselect = $('#godparent_status_chosen a span').text();
    if (gpselect == 'Has godparent' && (!$('#addgpbutton').length)) {
    $('#guardian').append('<p><button type="button" id="addgpbutton" class="btn btn-sm btn-success" data-toggle="modal" data-target="#godparentModal"> Add Godparent </button></p>');
    } 
  });

$('#godparent_status_chosen').on('click', function() {
  let gpselect = $('#godparent_status_chosen a span').text();
  if (gpselect == 'Has godparent' && (!$('#addgpbutton').length)) {
    $('#guardian').append('<p><button type="button" id="addgpbutton" class="btn btn-sm btn-success" data-toggle="modal" data-target="#godparentModal"> Add Godparent </button></p>');
  } 
  if (gpselect != 'Has godparent' && ($('#addgpbutton').length)) {
    $('#addgpbutton').remove();
  } 
  
});


// Retrieve godparent id from clicking list point
  $('#godparents_list i').on('click', function(e) {
    godparent_id = $(e.target).attr('data-id');
  });
  
// Delete godparent when confirming delete godparent warning modal
  $('#deleteGodparentForm').on('submit', function(e) {
    e && e.preventDefault();

    var data = {
      _csrf_token: $('#deleteGodparentForm input[name="_csrf_token"]').val(),
      godparent_id: godparent_id,
    };

    $.ajax({
      type: 'POST',
      url: '/delete-godparent/' + godparent_id,
      contentType: 'application/json',
      headers: {
        'X-CSRFToken': data._csrf_token,
      },
      success: function(response) {
        $("#deleteGodparentModalBody").html( "<p>Godparent deleted!</p>" );
        $("#deleteModalLabel").html( "DELETED" );
{'fraction_non_alphanumeric': 0.2040364943323196, 'fraction_numerical': 0.0, 'mean_word_length': 4.139204545454546, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '7121656', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1134, 'n_words': 228}