/** * Do some cleanup when we get a success response from a POST request * during setup * @param data the POST request return data */ function cleanupStep(data, e) { showFeedback(data); // If there are no errors, we can continue with // the installation process if (data.errors.length == 0) { // Call nextSlide from the submit button's context nextSlide.call($(e.target)); } removeOverlay(); } /** * Display the form feedback when we get POST results * @param data the POST request return data */ function showFeedback(data) { if (data.errors.length > 0) { $(".help-message").addClass("has-error"); $(".form-control-feedback").show(); } else { $(".help-message").addClass("has-success"); } toggleMessage(data.message); for (var i = 0; i < data.errors.length; i++) { $("#" + data.errors[i]).parent().addClass("has-error has-feedback"); } } /** * Reset form feedback when resubmitting */ function resetFeedback() { $(".form-control-feedback").hide(); $("#helpBlock").html(""); $(".has-error, .has-feedback").removeClass("has-error has-feedback"); } /** * Show the return message from the POST request, then set a timeout to hide it again * @param msg the return message from the POST request */ function toggleMessage(msg) { /* * Since setting display:none; on this element causes odd behaviour * with bootstrap, hide() the element so we can slide it in. * This is only really only necessary the first time this * function is called after page load. */ $(".help-message").hide(); $(".help-message").html(msg); $(".help-message").slideDown(200); window.setTimeout(function() { $(".help-message").slideUp(200); }, 3000); } /** * Show the overlay and loading gif */ function addOverlay() { $("body").append("