diff -r 5667c29be1a3 -r b2709805fafe app/soc/content/js/org-accept.js
--- a/app/soc/content/js/org-accept.js Mon Feb 16 19:30:33 2009 +0000
+++ b/app/soc/content/js/org-accept.js Mon Feb 16 20:38:35 2009 +0000
@@ -2,44 +2,93 @@
$("#applications_progress_bar").progressBar({showText: false});
});
-function acceptOrgInit() {
- $("#acceptance_text").fadeOut("slow",
- function() {
- $("#applications_progress_bar").fadeIn("slow");
- }
- );
- $.getJSON("{{ bulk_accept_link|safe }}",
+function acceptOrgInit(bulk_accept_link) {
+ // get the JSON object with details of every application for bulk acceptance
+ $.getJSON(bulk_accept_link,
function(data){
- setTimeout(function(){acceptOrg(data)}, 0);
+ // If there are applications to accept...
+ if (data.nr_applications!=0) {
+ //...then fade out the button, show the progress bar and call the function for acceptance
+ $("#button_accept").fadeOut("slow",
+ function() {
+ $("#applications_progress_bar").progressBar(0);
+ $("#button_accept").val("Bulk accept");
+ $("#description_done").html("");
+ $("#applications_progress_bar").fadeIn("slow", acceptOrgs(data));
+ }
+ );
+ }else {
+ $("#description_done").html("No organizations to accept");
+ }
}
);
}
-function acceptOrg(accepted_applications) {
- var application_index = 0, max_applications=accepted_applications.applications.length;
- for (application_index; application_index Error encountered, try again");
+ });
}
});
- }
- // tell the user we are done
- $("#description_done").html(" Done!");
-
+ // if there were no errors, continue the iteration
+ if (!error_happened) {
+ // prepare for new iteration and then recall this function
+ application_index++;
+ if (application_indexDone!");
+ }
+ }
+ },0);
}
-