<commit_before>$(document).ready(function() {
  listenButtons();
  // loadParticipants();
  listenParticipants();
  $(".participant-image").mouseenter(function() {
    // debugger
      $(this).parent().siblings(".delegate-button").show();
  })
})

var listenButtons = function() {

  $(".button").on('click', "#yes-button", function(e) {
    e.preventDefault();
    console.log("YEAH BUDDY");

    var issueId = $(".vote-board").attr('id');
    var url = '/issues/' + issueId + '/vote?value=yes';

    var request = $.ajax({
      type: "PATCH",
      url: url
    });

    request.done(function(data) {
      console.log("SUCCESS!");
      console.log(data);
    });

    request.fail(function(response) {
      console.log("FAIL!");
    });
  });

  $(".button").on('click', "#no-button", function(e){
    e.preventDefault();
    console.log("get out.");

    var issueId = $(".vote-board").attr('id');
    var url = '/issues/' + issueId + '/vote?value=no';

    var request = $.ajax({
      type: "PATCH",
      url: url
    });

    request.done(function(data) {
      console.log("SUCCESS!");
      console.log(data);
    });

    request.fail(function(response) {
      console.log("FAIL!");
    });
  });

}

var loadParticipants = function() {

  // $(".abstain-board").append()

}

var listenParticipants = function() {

    // .mouseleave(function() {
    //   $(this).parent().siblings(".delegate-button").hide();
    // })
  }


<commit_msg>refactor ajax calls for vote buttons<commit_after>$(document).ready(function() {
  listenButtons();
  // loadParticipants();
  listenParticipants();
  $(".participant-image").mouseenter(function() {
    // debugger
      $(this).parent().siblings(".delegate-button").show();
  })
})

var listenButtons = function() {

  voteButton("#yes-button", "yes");
  voteButton("#no-button", "no");

}

var loadParticipants = function() {

  // $(".abstain-board").append()

}

var listenParticipants = function() {

    // .mouseleave(function() {
    //   $(this).parent().siblings(".delegate-button").hide();
    // })
  }

var voteButton = function(buttonClass, voteValue) {
  $(".button").on('click', buttonClass, function(e) {
    e.preventDefault();

    var issueId = $(".vote-board").attr('id');
    var url = '/issues/' + issueId + '/vote?value='+voteValue;

    var request = $.ajax({
      type: "PATCH",
      url: url
    });

    request.done(function(data) {
      console.log("SUCCESS!");
      console.log(data);
    });

    request.fail(function(response) {
      console.log("FAIL!");
    });
  });
}



{'fraction_non_alphanumeric': 0.2197117257499026, 'fraction_numerical': 0.0, 'mean_word_length': 2.938650306748466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2002527', 'n_tokens_mistral': 845, 'n_tokens_neox': 809, 'n_words': 127}