Created
July 1, 2011 14:24
-
-
Save yorzi/1058639 to your computer and use it in GitHub Desktop.
js file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function signInModal(){ | |
$( "#sign_in" ).dialog({ | |
modal: true, | |
autoOpen: $("body").hasClass("show_login"), | |
resizable: false, | |
minWidth: 400 | |
}); | |
$("a.login, a#login_link").click(function(){ | |
$( "#sign_in" ).dialog("open"); | |
return false; | |
}); | |
$('#sign_in form input[type="submit"]').unbind("click").click(function(){ | |
form = $("#sign_in form"); | |
form.find("img").show(); | |
form.find("input[type='submit']").attr("disabled","disabled"); | |
form.find("input[type='submit']").addClass("inactive"); | |
$.ajax({ | |
url: form.attr("action") + ".js", | |
type: "post", | |
dataType: "json", | |
data: form.serialize(), | |
complete: function(){ | |
form.find("img").hide(); | |
form.find("input[type='submit']").removeAttr("disabled"); | |
form.find("input[type='submit']").removeClass("inactive"); | |
}, | |
success: function(data, response){ | |
form.find(".sign_in_flash.notice").show(); | |
window.location = data.redirect; | |
}, | |
error: function(){ | |
form.find(".sign_in_flash.error").show(); | |
}, | |
beforeSend: function(){ | |
form.find(".sign_in_flash").hide(); | |
} | |
}); | |
return false; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment