Skip to content

Instantly share code, notes, and snippets.

@nothingmuch
Created November 11, 2010 13:12
Show Gist options
  • Select an option

  • Save nothingmuch/672474 to your computer and use it in GitHub Desktop.

Select an option

Save nothingmuch/672474 to your computer and use it in GitHub Desktop.
var ajaxify_forms = function() {
$('form.validate').validate({
debug: true,
submitHandler: function (form) {
var before_submit = $(form).attr('beforeSubmit');
if ( before_submit.length ) {
var f;
eval("f = function () {" + before_submit + "}");
f.apply(form, []);
if ( $(form).hasClass("login_required") && !reask.user_exists ) {
display_signup_dialog({
after_signup: function () {
console.log(form);
form.submit();
}
});
} else {
console.log("submitting ", form);
form.submit();
}
}
}
});
};
var setup_dialogs = function () {
$("#signup_dialog").dialog({
autoOpen: false,
height: 600,
width: 900,
modal: true,
open: function () { },
close: function () { }
});
};
var display_signup_dialog = function(hooks) {
$("#signup_dialog").load("/signup?disable_wrapper=1", function() {
window.oauth_succeeded = function (url) {
$("#signup_dialog").dialog("close");
reask.user_exists = true;
hooks.after_signup();
//alert(url);
//$("#signup_dialog").load(url + "?disable_wrapper=1");
}
});
$("#signup_dialog").dialog("open");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment