diff options
author | Chad Kieffer <chad@2tbsp.com> | 2008-12-15 02:45:50 +0000 |
---|---|---|
committer | Chad Kieffer <chad@2tbsp.com> | 2008-12-15 02:45:50 +0000 |
commit | 119344d9db9873918995886af938f968cd21b922 (patch) | |
tree | 9b14d1b7c636141c2cc21c486f80dc19cd6a0e7f /modules/user/js/user.js | |
parent | a91492bc293360aca9ff2c0f5ec03537d02c1a08 (diff) |
Switched login display from display in the header to a dialog. Validation errors don't display on first failed attempt, will fix later. Moved jquery js, images, css out to respective folders.
Diffstat (limited to 'modules/user/js/user.js')
-rw-r--r-- | modules/user/js/user.js | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/modules/user/js/user.js b/modules/user/js/user.js index c3f292bf..021163b1 100644 --- a/modules/user/js/user.js +++ b/modules/user/js/user.js @@ -1,39 +1,23 @@ /** - * Display user login form - * - * @todo Close link should be reusable + * Ajaxify user login form */ -$("document").ready(function() { - $("#gLoginLink").click(function() { - var url = $("#gLoginLink a").attr("href"); - $.get(url, function(data) { - $('#gLoginLink').hide(); - $("#gLoginMenu").append('<li><a href="#">X</a></li>'); - $("#gLoginMenu li:last").addClass("gClose").show(); - $("#gLoginMenu .gClose a").click(function() { - $("#gLoginForm").remove(); - $("#gLoginMenu .gClose").remove(); - $("#gLoginFormContainer").hide(); - $("#gLoginLink").show(); - $("input#gUsername").val(""); - $("input#gPassword").val(""); - }); - $("#gLoginFormContainer").html(data).hide().fadeIn(); - ajaxify_login_form(); - }); - return false; - }); -}); - -function ajaxify_login_form() { +function ajaxify_login_form(event) { + event.preventDefault(); $("#gLoginForm").ajaxForm({ - target: "#gLoginFormContainer", + target: "#gDialog", success: function(responseText, statusText) { if (!responseText) { window.location.reload(); } else { - ajaxify_login_form(); + ajaxify_login_form(event); } } }); + return false; } + +$("document").ready(function() { + $.listen("submit", "#gLoginForm", function(event) { + ajaxify_login_form(event); + }); +}); |