aboutsummaryrefslogtreecommitdiff
// Generated by CoffeeScript 1.8.0
$(function() {
  var form_success, modalize, submit_form;
  modalize = function(event) {
    event.preventDefault();
    console.log("in modal_replace:", $(this).attr("href"));
    return $.colorbox({
      open: true,
      href: this.href,
      onComplete: function() {
        return $(".focused").focus();
      }
    });
  };
  $(document).one("click", ".modalize", modalize);
  console.log("Modalized click!!!");
  form_success = function(data) {
    return $.colorbox({
      open: true,
      html: data,
      onComplete: function() {
        return $("form").on("submit", submit_form);
      }
    });
  };
  submit_form = function(event) {
    var data, submit_to;
    event.preventDefault();
    submit_to = $(this).attr('action');
    data = $(this).serialize();
    console.log("submit_to is:", submit_to);
    return $.ajax({
      type: "POST",
      url: submit_to,
      data: data,
      dataType: "html",
      success: form_success
    });
  };
  return $("#colorbox form").on("submit", submit_form);
});