<commit_before><div class="container-fluid">
  <div class="row">
      <nav class="main navbar navbar-default bg-image-search">
        <div class="social-media">
          <a href="mailto:<EMAIL>?subject=I'd like more information">Contact Us</a>
          <a href="https://www.facebook.com/bushhoustonliteracy/" target="_blank"><img src="<%= asset_path('facebook.png') %>" /></a>
          <a href="https://twitter.com/BushHoustonLit" target="_blank"><img src="<%= asset_path('twitter.png') %>" /></a>
        </div>
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a href="/" class="non-admin"><img class="non-admin" src="<%= asset_path('my-home-library.png') %>" alt="<NAME> Houston Literacy Foundation" /></a>
          </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-left">
              <li><%= link_to 'About Us', scrivito_path(Obj.find_by_permalink('about')) %></li>
              <li><%= link_to 'FAQ', scrivito_path(Obj.find_by_permalink('faq')) %></li>
              <li><%= link_to 'Our Partners', scrivito_path(Obj.find_by_permalink('sponsors')) %></li>
              <li><%= link_to 'Our Impact', scrivito_path(Obj.find_by_permalink('impact')) %></li>
              <% unless session[:userinfo].nil?  -%>
              <% if user_is_admin? -%>
              <li><%= link_to 'Admin', '/admin' %></li>
              <% end -%>
              <li>
                <a class="non-admin" href="#"><img class="avatar" src="<%= session[:userinfo]['info']['image'] %>" alt="<%= session[:userinfo]['info']['name'] %>" />
                  <span class="hidden-sm"><%= session[:userinfo]['info']['name'] %></span>
                </a>
              </li>
              <li><a class="non-admin" href="/logout?returnTo=<%= request.base_url %>&client_id=<%= Rails.application.secrets.auth0_client_id %>">Logout</a></li>
              <% end -%>
            </ul>
            <div class="nav navbar-nav navbar-right">

              <li role="presentation" class="dropdown">
                <a class="dropdown-toggle non-admin btn" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                  Sponsor a Child <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="search">Sponsor Any Child</a></li>
                    <% Organization.where("is_included = ?", true).each do |org| %>
                    <li>
                      <%= link_to(org.name, search_url(org.slug)) %>
                    </li>
                    <% end %>
                </ul>
              </li>

              <li role="presentation" class="dropdown">
                <a class="dropdown-toggle non-admin btn" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                  Donate to Program <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="search">My Home Library General</a></li>
                    <% Organization.where("is_included = ?", true).each do |org| %>
                    <li>
                      <%= link_to(org.name, search_url(org.slug)) %>
                    </li>
                    <% end %>
                </ul>
              </li>
            </div>
          </div>
          <div class="page-headline">
            <h1>Sponsor a Child</h1>
            <h3>Donate a Home Library to a Child in Need</h3>
          </div>
          <div class="col-md-0 col-md-offset-6 col-sm-offset-6 col-xs-offset-6 mouse">
            <img src="<%= asset_path('scroll-button.png') %>" />
          </div>
      </nav>
  </div>


  <div class="row featurette hero-top">
    <div class="col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4">
      <% if live_campaigns? %>
        <%= form_tag("/wishlists?slug=#{params[:slug]}", method: :get, remote: true) do %>
          <div class="input-group search-bar">
            <input class="form-control" name="term" id="term" placeholder="Find a child, teacher, or school" />
            <span class="input-group-btn">
              <button class="btn btn-default" type="submit">
                <span class="glyphicon glyphicon-search"></span>
              </button>
            </span>
        </div>
        <% end -%>
      <% end -%>
      <!-- <h2 class="featurette-heading">Home Libraries<%= " for #{@organization.name}" unless @organization.nil? %></h2> -->
      <!-- <p class="lead"><%= live_campaigns? ? @content['sponsor_lead'] : @content['sponsor_lead_no_campaign'] %></p> -->
      <h4 id="specific-child">No specific child request? Browse below or let us pick for you with a</h4>
      <% if @organization.nil? -%>
        <p class="donation" data-toggle="tooltip" title="General Program Donation will be disabled once child/children selected. If you'd like to add a general donation to your specific child/children sponsorship, please add another child and fill in your donation, or click Complete My Donation on the left side and add to your total.">
          <%= link_to 'Program Donation', donate_url(:id_list => ""), :class => 'btn btn-primary', :id => 'program-checkout' %>
        </p>
      <% else -%>
        <p class="donation">
          <%= link_to "Program Donation to #{@organization.name}", donate_url(:campaign_id => @organization.current_campaign), :class => 'btn btn-primary', :id => 'program-checkout' if live_campaigns? %>
          <%= link_to "Program Donation to #{@organization.name}", donate_url(:organization_id => @organization.id), :class => 'btn btn-primary', :id => 'program-checkout' unless live_campaigns? %>
        </p>
      <% end -%>
    </div>
  </div>

  <% if live_campaigns? -%>
  <div class="row">
    <div class="col-md-3 col-sm-3">
       <div id="sponsor-list" data-id-list="" data-spy="affix" data-offset-top="540">
        <% if live_campaigns? -%>
          <div class="sponsor-shoppingcart">
            <div class="sponsor-header">
              <h4 class="sponsor-title">Children You've Selected</h4>
            </div>

            <ul class="list-group" id="sponsor-unordered-list">
              <li id="empty-list-message" class="list-group-item disabled">No wish lists selected</li>
            </ul>
            <span id="subtotal">Your Subtotal: $0.00</span>
          </div>
          <%= link_to 'Complete My Donation', donate_url(:id_list => ""), :class => 'btn disabled btn-lg', :id => 'checkout-btn' %>
        <% end -%>
      </div>
    </div>
    <div class="col-md-8 col-sm-8">
      <div id="search_results">
        <%= render partial: 'search_results', locals: {wishlists: @wishlists} %>
      </div>

    </div>
  </div>

  <div class="row">
    <div class="col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4">
      <p>
        <%= link_to 'Load More Wish Lists', "/wishlists?slug=#{params[:slug]}&append=true", :remote => true, :class => 'btn', :id => 'load-more' %>
      </p>
    </div>
  </div>
  <% end -%>

  <div class="row search-description">
    <div class="col-md-5 col-md-offset-3 col-sm-5 col-sm-offset-3">
    </div>
  </div>
  <div class="row">
    <div class="search-bg-teacher">
        <img src="<%= asset_path('kids_bg_3.jpg') %>" />
    </div>
  </div>


</div>

<%= content_for :foot do %>
<script>
var preselected = "<%= session[:wishlist_cart] %>";

if(preselected.length > 0){
  $(document).ready(function() {
    $.each(preselected.split(','), function(idx, id){
      addIdToCart(id);
    });
  });
}

$('body').on('click', '.donation a', function(){
  var modalDonation = '<div><button type="button" class="btn btn-default" data-dismiss="modal">Sponsor a Child</button></div>\
  <div class="input-group"><span>Please input your amount:</span>\
  <input type="number" step="1.00" id="addl_donation_slug" class="form-control" placeholder="Enter dollar amount" /></div>\
  <div><% if @organization.nil? -%>\
  <%= link_to "Complete Donation", donate_url(), :class => "btn btn-warning btn-lg focus", :id => "checkout-btn-3" %></div>\
  <% else -%>\
  <%= link_to "Complete Donation to #{@organization.name}", donate_url(:campaign_id => @organization.current_campaign), :id => "checkout-btn-3", :class => 'btn btn-warning btn-lg focus' if live_campaigns? %>\
  <%= link_to "Complete Donation to #{@organization.name}", donate_url(:organization_id => @organization.id), :id => "checkout-btn-3", :class => 'btn btn-warning btn-lg focus' unless live_campaigns? %>\
  <% end -%>'

  $("#globalModalShopping .modal-body").html(modalDonation);
  $('#globalModalShopping').modal();

  return false;
});

$('body').on("click", '.search-entry a', function() {
  if (!$('#sponsor-list').is(':visible')) return true;
  var entry = $(this).closest('.search-entry');
  addToCart(entry);

  var template = $('#place-inside-template').html()

  var names = $('.donation-info strong').slice(0,2).map(function(){ return $(this).text(); }).get().join('and ')

  $("#globalModalShopping .modal-body").html(template);

  var list = $('#sponsor-list');
  var idList = list.data('id-list');
  var checkoutBtn = $('#checkout-btn-2');
  var href = checkoutBtn.attr('href');
  if (href) {
    href = href.replace(/\?.+/, "") + "?id_list=" + idList;
    checkoutBtn.attr('href', href);
  }

  $('#globalModalShopping').modal();
  $(".sponsor-shoppingcart").clone().appendTo(".modal-shopping-info");
  $(".kid-names").html(names);

  return false;
});

$('body').on("click", '.list-group-item button', function() {
  var entry = $(this).closest('li');
  var id = entry.data('wishlist-id');
  var idList = updateIdList(id, null, true);
  entry.remove();

  return false;
});

function updateIdList(id, text, isRemove) {
  var list = $('#sponsor-list');
  var idList = list.data('id-list');

  if (idList.length == 0) {
    idList = [];
  }

  if (!isRemove && idList.indexOf(id) >= 0) {
    return idList;
  }

  if (isRemove) {
    idList.splice(idList.indexOf(id), 1);
  } else {
    idList[idList.length] = id;
  }


  updateCheckoutUrl(idList);
  list.data('id-list', idList);

  $('#subtotal').html('Your Subtotal: <p class="dollars">$' + Number(idList.length*(30)).toFixed(2)) + '</p>';
  if (!isRemove) {
    var li = $('<li class="list-group-item donation-group"><p class="donation-info"><strong>' + text.split('-')[0] + '</strong></p><p class="donation-amt dollars">$30.00</p><button class="sponsor-btn close btn-sm">Remove</button></li>');
    li.data('wishlist-id', id);
    list.find('ul').append(li);
  } else {
    $(".search-entry[data-wishlist-id=" + id + "] a").removeClass('disabled');
    $(".search-entry[data-wishlist-id=" + id + "] a").removeClass('btn-sponsored');
    $(".search-entry[data-wishlist-id=" + id + "] a").addClass('btn-notsponsored');
    $(".search-entry[data-wishlist-id=" + id + "] a").html('Sponsor This Child');

  }

  return idList;
}

function addIdToCart(id) {
  var wishlist = $('.search-entry[data-wishlist-id=' + id + ']');
  addToCart(wishlist);
}

function addToCart(entry) {
  //console.log(entry)
  var idList = updateIdList(entry.data('wishlist-id'), entry.find('h3').html());
  entry.find('a').addClass('disabled');
  entry.find('a').addClass('btn-sponsored');
  entry.find('a').removeClass('btn-notsponsored');
  entry.find('a').html('Selected');
}

function updateCheckoutUrl(idList) {
  var checkoutBtn = $('#checkout-btn');
  if (idList.length == 0) {
    $('#empty-list-message').show();
    checkoutBtn.addClass('disabled');
    $('#program-checkout').removeClass('disabled');
  } else {
    $('#empty-list-message').hide();
    checkoutBtn.removeClass('disabled');
    $('#program-checkout').addClass('disabled');
  }

  var href = checkoutBtn.attr('href');
  if (href) {
    href = href.replace(/\?.+/, "") + "?id_list=" + idList;
    checkoutBtn.attr('href', href);
  }
}

$('body').on("change", '#addl_donation', function() {
  var link = $("#checkout-btn").attr('href');
  $("#checkout-btn-2").attr("href", link + '&addl_donation=' + $(this).val());
});

$('body').on("change", '#addl_donation_slug', function() {
  var link = $("#program-checkout").attr('href');
  $("#checkout-btn-3").attr("href", link + '&addl_donation=' + $(this).val());
});

</script>

<% end %>
<%= render 'common/modal' %>

<script type="text/template" id="place-inside-template">
  <div class="container-fluid">
    <div class="row">
      <div><h2>Ready to Complete your Sponsorship?</h2></div>
      <div class="col-md-6 modal-shopping-info"></div>
      <div class="col-md-6 modal-shopping-description">
        <div class="row">
          <div class="col-md-6" style="padding-left: 0;">
            <h4>Thank you!</h4>
            <p>Have you thought about sponsoring other children? There are many more students like <span class="kid-names"></span> that would love to have their very own home library! Would you like to keep browsing?</p>
          </div>
          <div class="col-md-6" style="padding-bottom: 0;">
              <img src="<%= asset_path('kids6.jpg') %>" />
              <img src="<%= asset_path('kids8.png') %>" />
          </div>
          <button type="button" class="select-children btn btn-default" data-dismiss="modal">Yes! Select more children!</button>
        </div>
      </div>
    </div>
    <div class="general-donation-option">
      <div class="input-group"><h3>You can also add a general donation as well!</h3>
      <input type="number" step="1.00" id="addl_donation" class="form-control" placeholder="Enter dollar amount" /></div>
      <%= link_to "Complete My Sponsorship", donate_url(:id_list => ""), :class => "btn btn-md", :id => "checkout-btn-2" %>
    </div>
  </div>
</script>

<script type="text/javascript">
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
});
</script>
<commit_msg>added popup dialog to all program donation buttons, including school specific ones<commit_after><div class="container-fluid">
  <div class="row">
      <nav class="main navbar navbar-default bg-image-search">
        <div class="social-media">
          <a href="mailto:<EMAIL>?subject=I'd like more information">Contact Us</a>
          <a href="https://www.facebook.com/bushhoustonliteracy/" target="_blank"><img src="<%= asset_path('facebook.png') %>" /></a>
          <a href="https://twitter.com/BushHoustonLit" target="_blank"><img src="<%= asset_path('twitter.png') %>" /></a>
        </div>
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a href="/" class="non-admin"><img class="non-admin" src="<%= asset_path('my-home-library.png') %>" alt="<NAME> Houston Literacy Foundation" /></a>
          </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-left">
              <li><%= link_to 'About Us', scrivito_path(Obj.find_by_permalink('about')) %></li>
              <li><%= link_to 'FAQ', scrivito_path(Obj.find_by_permalink('faq')) %></li>
              <li><%= link_to 'Our Partners', scrivito_path(Obj.find_by_permalink('sponsors')) %></li>
              <li><%= link_to 'Our Impact', scrivito_path(Obj.find_by_permalink('impact')) %></li>
              <% unless session[:userinfo].nil?  -%>
              <% if user_is_admin? -%>
              <li><%= link_to 'Admin', '/admin' %></li>
              <% end -%>
              <li>
                <a class="non-admin" href="#"><img class="avatar" src="<%= session[:userinfo]['info']['image'] %>" alt="<%= session[:userinfo]['info']['name'] %>" />
                  <span class="hidden-sm"><%= session[:userinfo]['info']['name'] %></span>
                </a>
              </li>
              <li><a class="non-admin" href="/logout?returnTo=<%= request.base_url %>&client_id=<%= Rails.application.secrets.auth0_client_id %>">Logout</a></li>
              <% end -%>
            </ul>
            <div class="nav navbar-nav navbar-right">

              <li role="presentation" class="dropdown">
                <a class="dropdown-toggle non-admin btn" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                  Sponsor a Child <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="search">Sponsor Any Child</a></li>
                    <% Organization.where("is_included = ?", true).each do |org| %>
                    <li>
                      <%= link_to(org.name, search_url(org.slug)) %>
                    </li>
                    <% end %>
                </ul>
              </li>

              <li role="presentation" class="dropdown">
                <a class="dropdown-toggle non-admin btn" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                  Donate to Program <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="search">My Home Library General</a></li>
                    <% Organization.where("is_included = ?", true).each do |org| %>
                    <li>
                      <%= link_to(org.name, search_url(org.slug)) %>
                    </li>
                    <% end %>
                </ul>
              </li>
            </div>
          </div>
          <div class="page-headline">
            <h1>Sponsor a Child</h1>
            <h3>Donate a Home Library to a Child in Need</h3>
          </div>
          <div class="col-md-0 col-md-offset-6 col-sm-offset-6 col-xs-offset-6 mouse">
            <img src="<%= asset_path('scroll-button.png') %>" />
          </div>
      </nav>
  </div>


  <div class="row featurette hero-top">
    <div class="col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4">
      <% if live_campaigns? %>
        <%= form_tag("/wishlists?slug=#{params[:slug]}", method: :get, remote: true) do %>
          <div class="input-group search-bar">
            <input class="form-control" name="term" id="term" placeholder="Find a child, teacher, or school" />
            <span class="input-group-btn">
              <button class="btn btn-default" type="submit">
                <span class="glyphicon glyphicon-search"></span>
              </button>
            </span>
        </div>
        <% end -%>
      <% end -%>
      <!-- <h2 class="featurette-heading">Home Libraries<%= " for #{@organization.name}" unless @organization.nil? %></h2> -->
      <!-- <p class="lead"><%= live_campaigns? ? @content['sponsor_lead'] : @content['sponsor_lead_no_campaign'] %></p> -->
      <h4 id="specific-child">No specific child request? Browse below or let us pick for you with a</h4>
      <% if @organization.nil? -%>
        <p class="donation" data-toggle="tooltip" title="Make a general donation here if you’re not sponsoring any specific children.  If you'd like to add a general donation to your specific child/children sponsorship, please click Complete My Donation on the left side and add that amount to your total.">
          <%= link_to 'Program Donation', donate_url(:id_list => ""), :class => 'btn btn-primary', :id => 'program-checkout' %>
        </p>
      <% else -%>
        <p class="donation" data-toggle="tooltip" title="Make a general donation here if you’re not sponsoring any specific children.  If you'd like to add a general donation to your specific child/children sponsorship, please click Complete My Donation on the left side and add that amount to your total.">
          <%= link_to "Program Donation to #{@organization.name}", donate_url(:campaign_id => @organization.current_campaign), :class => 'btn btn-primary', :id => 'program-checkout' if live_campaigns? %>
          <%= link_to "Program Donation to #{@organization.name}", donate_url(:organization_id => @organization.id), :class => 'btn btn-primary', :id => 'program-checkout' unless live_campaigns? %>
        </p>
      <% end -%>
    </div>
  </div>

  <% if live_campaigns? -%>
  <div class="row">
    <div class="col-md-3 col-sm-3">
       <div id="sponsor-list" data-id-list="" data-spy="affix" data-offset-top="540">
        <% if live_campaigns? -%>
          <div class="sponsor-shoppingcart">
            <div class="sponsor-header">
              <h4 class="sponsor-title">Children You've Selected</h4>
            </div>

            <ul class="list-group" id="sponsor-unordered-list">
              <li id="empty-list-message" class="list-group-item disabled">No wish lists selected</li>
            </ul>
            <span id="subtotal">Your Subtotal: $0.00</span>
          </div>
          <%= link_to 'Complete My Donation', donate_url(:id_list => ""), :class => 'btn disabled btn-lg', :id => 'checkout-btn' %>
        <% end -%>
      </div>
    </div>
    <div class="col-md-8 col-sm-8">
      <div id="search_results">
        <%= render partial: 'search_results', locals: {wishlists: @wishlists} %>
      </div>

    </div>
  </div>

  <div class="row">
    <div class="col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4">
      <p>
        <%= link_to 'Load More Wish Lists', "/wishlists?slug=#{params[:slug]}&append=true", :remote => true, :class => 'btn', :id => 'load-more' %>
      </p>
    </div>
  </div>
  <% end -%>

  <div class="row search-description">
    <div class="col-md-5 col-md-offset-3 col-sm-5 col-sm-offset-3">
    </div>
  </div>
  <div class="row">
    <div class="search-bg-teacher">
        <img src="<%= asset_path('kids_bg_3.jpg') %>" />
    </div>
  </div>


</div>

<%= content_for :foot do %>
<script>
var preselected = "<%= session[:wishlist_cart] %>";

if(preselected.length > 0){
  $(document).ready(function() {
    $.each(preselected.split(','), function(idx, id){
      addIdToCart(id);
    });
  });
}

$('body').on('click', '.donation a', function(){
  var modalDonation = '<div><button type="button" class="btn btn-default" data-dismiss="modal">Sponsor a Child</button></div>\
  <div class="input-group"><span>Please input your amount:</span>\
  <input type="number" step="1.00" id="addl_donation_slug" class="form-control" placeholder="Enter dollar amount" /></div>\
  <div><% if @organization.nil? -%>\
  <%= link_to "Complete Donation", donate_url(), :class => "btn btn-warning btn-lg focus", :id => "checkout-btn-3" %></div>\
  <% else -%>\
  <%= link_to "Complete Donation to #{@organization.name}", donate_url(:campaign_id => @organization.current_campaign), :id => "checkout-btn-3", :class => 'btn btn-warning btn-lg focus' if live_campaigns? %>\
  <%= link_to "Complete Donation to #{@organization.name}", donate_url(:organization_id => @organization.id), :id => "checkout-btn-3", :class => 'btn btn-warning btn-lg focus' unless live_campaigns? %>\
  <% end -%>'

  $("#globalModalShopping .modal-body").html(modalDonation);
  $('#globalModalShopping').modal();

  return false;
});

$('body').on("click", '.search-entry a', function() {
  if (!$('#sponsor-list').is(':visible')) return true;
  var entry = $(this).closest('.search-entry');
  addToCart(entry);

  var template = $('#place-inside-template').html()

  var names = $('.donation-info strong').slice(0,2).map(function(){ return $(this).text(); }).get().join('and ')

  $("#globalModalShopping .modal-body").html(template);

  var list = $('#sponsor-list');
  var idList = list.data('id-list');
  var checkoutBtn = $('#checkout-btn-2');
  var href = checkoutBtn.attr('href');
  if (href) {
    href = href.replace(/\?.+/, "") + "?id_list=" + idList;
    checkoutBtn.attr('href', href);
  }

  $('#globalModalShopping').modal();
  $(".sponsor-shoppingcart").clone().appendTo(".modal-shopping-info");
  $(".kid-names").html(names);

  return false;
});

$('body').on("click", '.list-group-item button', function() {
  var entry = $(this).closest('li');
  var id = entry.data('wishlist-id');
  var idList = updateIdList(id, null, true);
  entry.remove();

  return false;
});

function updateIdList(id, text, isRemove) {
  var list = $('#sponsor-list');
  var idList = list.data('id-list');

  if (idList.length == 0) {
    idList = [];
  }

  if (!isRemove && idList.indexOf(id) >= 0) {
    return idList;
  }

  if (isRemove) {
    idList.splice(idList.indexOf(id), 1);
  } else {
    idList[idList.length] = id;
  }


  updateCheckoutUrl(idList);
  list.data('id-list', idList);

  $('#subtotal').html('Your Subtotal: <p class="dollars">$' + Number(idList.length*(30)).toFixed(2)) + '</p>';
  if (!isRemove) {
    var li = $('<li class="list-group-item donation-group"><p class="donation-info"><strong>' + text.split('-')[0] + '</strong></p><p class="donation-amt dollars">$30.00</p><button class="sponsor-btn close btn-sm">Remove</button></li>');
    li.data('wishlist-id', id);
    list.find('ul').append(li);
  } else {
    $(".search-entry[data-wishlist-id=" + id + "] a").removeClass('disabled');
    $(".search-entry[data-wishlist-id=" + id + "] a").removeClass('btn-sponsored');
    $(".search-entry[data-wishlist-id=" + id + "] a").addClass('btn-notsponsored');
    $(".search-entry[data-wishlist-id=" + id + "] a").html('Sponsor This Child');

  }

  return idList;
}

function addIdToCart(id) {
  var wishlist = $('.search-entry[data-wishlist-id=' + id + ']');
  addToCart(wishlist);
}

function addToCart(entry) {
  //console.log(entry)
  var idList = updateIdList(entry.data('wishlist-id'), entry.find('h3').html());
  entry.find('a').addClass('disabled');
  entry.find('a').addClass('btn-sponsored');
  entry.find('a').removeClass('btn-notsponsored');
  entry.find('a').html('Selected');
}

function updateCheckoutUrl(idList) {
  var checkoutBtn = $('#checkout-btn');
  if (idList.length == 0) {
    $('#empty-list-message').show();
    checkoutBtn.addClass('disabled');
    $('#program-checkout').removeClass('disabled');
  } else {
    $('#empty-list-message').hide();
    checkoutBtn.removeClass('disabled');
    $('#program-checkout').addClass('disabled');
  }

  var href = checkoutBtn.attr('href');
  if (href) {
    href = href.replace(/\?.+/, "") + "?id_list=" + idList;
    checkoutBtn.attr('href', href);
  }
}

$('body').on("change", '#addl_donation', function() {
  var link = $("#checkout-btn").attr('href');
  $("#checkout-btn-2").attr("href", link + '&addl_donation=' + $(this).val());
});

$('body').on("change", '#addl_donation_slug', function() {
  var link = $("#program-checkout").attr('href');
  $("#checkout-btn-3").attr("href", link + '&addl_donation=' + $(this).val());
});

</script>

<% end %>
<%= render 'common/modal' %>

<script type="text/template" id="place-inside-template">
  <div class="container-fluid">
    <div class="row">
      <div><h2>Ready to Complete your Sponsorship?</h2></div>
      <div class="col-md-6 modal-shopping-info"></div>
      <div class="col-md-6 modal-shopping-description">
        <div class="row">
          <div class="col-md-6" style="padding-left: 0;">
            <h4>Thank you!</h4>
            <p>Have you thought about sponsoring other children? There are many more students like <span class="kid-names"></span> that would love to have their very own home library! Would you like to keep browsing?</p>
          </div>
          <div class="col-md-6" style="padding-bottom: 0;">
              <img src="<%= asset_path('kids6.jpg') %>" />
              <img src="<%= asset_path('kids8.png') %>" />
          </div>
          <button type="button" class="select-children btn btn-default" data-dismiss="modal">Yes! Select more children!</button>
        </div>
      </div>
    </div>
    <div class="general-donation-option">
      <div class="input-group"><h3>You can also add a general donation as well!</h3>
      <input type="number" step="1.00" id="addl_donation" class="form-control" placeholder="Enter dollar amount" /></div>
      <%= link_to "Complete My Sponsorship", donate_url(:id_list => ""), :class => "btn btn-md", :id => "checkout-btn-2" %>
    </div>
  </div>
</script>

<script type="text/javascript">
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
});
</script>

{'fraction_non_alphanumeric': 0.20583315910516412, 'fraction_numerical': 0.0056449926824168935, 'mean_word_length': 2.882965769178731, 'pattern_counts': {'":': 0, '<': 563, '<?xml version=': 0, '>': 619, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '5692336', 'n_tokens_mistral': 9692, 'n_tokens_neox': 9231, 'n_words': 1911}