<commit_before><div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>window.twttr = (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0],
    t = window.twttr || {};
  if (d.getElementById(id)) return t;
  js = d.createElement(s);
  js.id = id;
  js.src = "https://platform.twitter.com/widgets.js";
  fjs.parentNode.insertBefore(js, fjs);

  t._e = [];
  t.ready = function(f) {
    t._e.push(f);
  };

  return t;
}(document, "script", "twitter-wjs"));</script>
 <script>
var Campaign = "<%= @Campaign %>"; //Campaign name
var SchoolName = "<%= @schoolname %>"; //Organization name
var WishlistID = "<%= @wishListID %>"; // org wishlist ID
var DonationLevel = <%= @donationLevel %>; // org donationlevel
var ReaderName = "<%= @reader_name %>"; // reader name
var CampaignId = "<%= @campaign_id %>"; // campaign id
var is_classroom_sponsored = <%= @is_classroom_sponsored %>;
var is_grade_sponsored = <%= @is_grade_sponsored %>;

function kimbiaSuccess(kimbiaResponse) {
  var initCharge = kimbiaResponse.initialCharge.replace("$", "");
  var confCode = kimbiaResponse.confirmationCode;
  var wishlistId = getValueByLabel(kimbiaResponse.answers[0], 'Wishlist ID');
  var is_in_kind = $('#chk-in-kind').is(':checked');
  $('.k_footer,.k_navigationSpan,.back-wishlist-btn').hide();
  $('.share-btn-box').removeClass('share-btn-box-hide').addClass('share-btn-box-show');
  $.ajax({
    url: '<%= success_url %>',
    dataType: 'json',
    method: 'POST',
    data: {'id_list': wishlistId, 
    'amount': initCharge, 
    'confirmation_code': confCode, 
    'campaign_id': CampaignId, 
    'is_classroom_sponsored': is_classroom_sponsored,
    'is_grade_sponsored': is_grade_sponsored,
    'is_in_kind': is_in_kind,
    'in_name_of': $('#in-name-of').val(),
    'in_kind_message': $('#in-kind-message').val()
    },
    success: function(data) {
      if (is_in_kind) {
        $('#in-kind-link-container').toggleClass('hidden');
        var href = $('#in-kind-link').attr('href');
        href += confCode;
        $('#in-kind-link').attr('href', href);
        $('#in-kind-link').html(href);
      }
    }
  });
}
//Helper function from Widget_DataObject_JS.pdf
function getValueByLabel(aSignup, labelText, sublabelText){
  for(var a = 0; a < aSignup.length; a++){
    var formAnswerObject = aSignup[a];
    if(formAnswerObject.questionLabel === labelText){
      if(sublabelText == null || sublabelText == '' || formAnswerObject.questionSubLabel == sublabelText) {
        return formAnswerObject.data;
      }
    }
  }
  // found none
  return '';
}

function showPayment() {
  //$("input[name=DonationLevel_FEE]").focus();
  //$("input[name=DonationLevel_FEE]").blur();
  $("input[name=DonationLevel_FEE]").prop("disabled", true);
}

function kimbiaSubmit(f) {
  $(f.view.theForm.getElementsByTagName('button')[0]).hide();
  $(f.view.theForm.getElementsByTagName('button')[0]).after($('<span id="spinner">Submitting...</span>'));
  $('#in-kind-container').hide();
}

function kimbiaResponse(f) {
  $(f.view.theForm.getElementsByTagName('button')[0]).show();
  $(f.view.theForm.getElementsByTagName('button')[0]).find('#spinner').remove();
}

</script>
<div class="container-fluid">
  <div class="row bg-image-donate">
    <%= render 'common/navbar' %>
  </div>
</div>

<div class="container">
  <p>&nbsp;</p>
  <p class="back-wishlist-btn">
    <%= link_to 'Wish Lists', search_url(@slug), class: 'btn btn-primary btn-lg' %> Back to wish list search
  </p>

  <div class="panel panel-default" id="in-kind-container">
    <div class="panel-body">
      <h4>Donate in honor of option. <small>(limit 1 honoree per donation)</small></h4>
      <div class="checkbox form-group">
        <label>
          <input type="checkbox" id="chk-in-kind"> Make this donation in honor of someone
        </label>
      </div>
      <div class="form-group hidden in-kind">
        <label for="in-name-of">Honoree Name</label>
        <input type="text" class="form-control" id="in-name-of" placeholder="Name">
      </div>
      <div class="form-group hidden in-kind">
        <label for="in-kind-message">Special Message</label>
        <textarea class="form-control" rows="3" id="in-kind-message" maxlength="255"></textarea>
      </div>
      <p>Upon checkout, a certificate with the honoree’s name and your special message will open on a new page that you can print and mail. </p>
    </div>
  </div>
  

  

<!-- script to populate form tag -->
<% if ENV['IS_PRODUCTION'] %>
<script src="https://widgets.kimbia.com/widgets/form.js?channel=barbarabushhoustonliteracyfoundation/bbhlvirtualbookdrive&onshow=showPayment&oncomplete=kimbiaSuccess&onbeforesubmit=kimbiaSubmit&onplatformresponse=kimbiaResponse"></script>
<% else %>
<script src='https://widgets.kimbia.com/widgets/form.js?channel=barbarabushhoustonliteracyfoundation/bbhlvirtualbookdrivetest&onshow=showPayment&oncomplete=kimbiaSuccess&onbeforesubmit=kimbiaSubmit&onplatformresponse=kimbiaResponse'></script>
<% end %>
  <div class="share-btn-box share-btn-box-hide">
    <div class="panel panel-default hidden" id="in-kind-link-container"><commit_msg>Fix CC info not showing<commit_after><div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>window.twttr = (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0],
    t = window.twttr || {};
  if (d.getElementById(id)) return t;
  js = d.createElement(s);
  js.id = id;
  js.src = "https://platform.twitter.com/widgets.js";
  fjs.parentNode.insertBefore(js, fjs);

  t._e = [];
  t.ready = function(f) {
    t._e.push(f);
  };

  return t;
}(document, "script", "twitter-wjs"));</script>
 <script>
var Campaign = "<%= @Campaign %>"; //Campaign name
var SchoolName = "<%= @schoolname %>"; //Organization name
var WishlistID = "<%= @wishListID %>"; // org wishlist ID
var DonationLevel = <%= @donationLevel %>; // org donationlevel
var ReaderName = "<%= @reader_name %>"; // reader name
var CampaignId = "<%= @campaign_id %>"; // campaign id
var is_classroom_sponsored = <%= @is_classroom_sponsored %>;
var is_grade_sponsored = <%= @is_grade_sponsored %>;

function kimbiaSuccess(kimbiaResponse) {
  var initCharge = kimbiaResponse.initialCharge.replace("$", "");
  var confCode = kimbiaResponse.confirmationCode;
  var wishlistId = getValueByLabel(kimbiaResponse.answers[0], 'Wishlist ID');
  var is_in_kind = $('#chk-in-kind').is(':checked');
  $('.k_footer,.k_navigationSpan,.back-wishlist-btn').hide();
  $('.share-btn-box').removeClass('share-btn-box-hide').addClass('share-btn-box-show');
  $.ajax({
    url: '<%= success_url %>',
    dataType: 'json',
    method: 'POST',
    data: {'id_list': wishlistId,
    'amount': initCharge,
    'confirmation_code': confCode,
    'campaign_id': CampaignId,
    'is_classroom_sponsored': is_classroom_sponsored,
    'is_grade_sponsored': is_grade_sponsored,
    'is_in_kind': is_in_kind,
    'in_name_of': $('#in-name-of').val(),
    'in_kind_message': $('#in-kind-message').val()
    },
    success: function(data) {
      if (is_in_kind) {
        $('#in-kind-link-container').toggleClass('hidden');
        var href = $('#in-kind-link').attr('href');
        href += confCode;
        $('#in-kind-link').attr('href', href);
        $('#in-kind-link').html(href);
      }
    }
  });
}
//Helper function from Widget_DataObject_JS.pdf
function getValueByLabel(aSignup, labelText, sublabelText){
  for(var a = 0; a < aSignup.length; a++){
    var formAnswerObject = aSignup[a];
    if(formAnswerObject.questionLabel === labelText){
      if(sublabelText == null || sublabelText == '' || formAnswerObject.questionSubLabel == sublabelText) {
        return formAnswerObject.data;
      }
    }
  }
  // found none
  return '';
}

function showPayment() {
  $("input[name=DonationLevel_FEE]").focus();
  $("input[name=DonationLevel_FEE]").blur();
  $("input[name=DonationLevel_FEE]").prop("disabled", true);
}

function kimbiaSubmit(f) {
  $(f.view.theForm.getElementsByTagName('button')[0]).hide();
  $(f.view.theForm.getElementsByTagName('button')[0]).after($('<span id="spinner">Submitting...</span>'));
  $('#in-kind-container').hide();
}

function kimbiaResponse(f) {
  $(f.view.theForm.getElementsByTagName('button')[0]).show();
  $(f.view.theForm.getElementsByTagName('button')[0]).find('#spinner').remove();
}

</script>
<div class="container-fluid">
  <div class="row bg-image-donate">
    <%= render 'common/navbar' %>
  </div>
</div>

<div class="container">
  <p>&nbsp;</p>
  <p class="back-wishlist-btn">
    <%= link_to 'Wish Lists', search_url(@slug), class: 'btn btn-primary btn-lg' %> Back to wish list search
  </p>

  <div class="panel panel-default" id="in-kind-container">
    <div class="panel-body">
      <h4>Donate in honor of option. <small>(limit 1 honoree per donation)</small></h4>
      <div class="checkbox form-group">
        <label>
          <input type="checkbox" id="chk-in-kind"> Make this donation in honor of someone
        </label>
      </div>
      <div class="form-group hidden in-kind">
        <label for="in-name-of">Honoree Name</label>
        <input type="text" class="form-control" id="in-name-of" placeholder="Name">
      </div>
      <div class="form-group hidden in-kind">
        <label for="in-kind-message">Special Message</label>
        <textarea class="form-control" rows="3" id="in-kind-message" maxlength="255"></textarea>
      </div>
      <p>Upon checkout, a certificate with the honoree’s name and your special message will open on a new page that you can print and mail. </p>
    </div>
  </div>




<!-- script to populate form tag -->
<% if ENV['IS_PRODUCTION'] %>
<script src="https://widgets.kimbia.com/widgets/form.js?channel=barbarabushhoustonliteracyfoundation/bbhlvirtualbookdrive&onshow=showPayment&oncomplete=kimbiaSuccess&onbeforesubmit=kimbiaSubmit&onplatformresponse=kimbiaResponse"></script>
<% else %>
<script src='https://widgets.kimbia.com/widgets/form.js?channel=barbarabushhoustonliteracyfoundation/bbhlvirtualbookdrivetest&onshow=showPayment&oncomplete=kimbiaSuccess&onbeforesubmit=kimbiaSubmit&onplatformresponse=kimbiaResponse'></script>
<% end %>
  <div class="share-btn-box share-btn-box-hide">
    <div class="panel panel-default hidden" id="in-kind-link-container">
{'fraction_non_alphanumeric': 0.18825050803620913, 'fraction_numerical': 0.0035100683539626824, 'mean_word_length': 4.284040995607613, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 135, 'https://': 8, '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': '4097102', 'n_tokens_mistral': 3856, 'n_tokens_neox': 3723, 'n_words': 661}