diff --git a/CHANGES.txt b/CHANGES.txt index 32edc8e..b3e554f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 2.0.8 (unreleased) ------------------ +- Automatically reload batch moderation page if no comments are left. This + fixes http://dev.plone.org/plone/ticket/11298. + [timo] + 2.0.7 (2011-07-15) ------------------ diff --git a/plone/app/discussion/browser/javascripts/moderation.js b/plone/app/discussion/browser/javascripts/moderation.js index bc26f09..a5cade1 100644 --- a/plone/app/discussion/browser/javascripts/moderation.js +++ b/plone/app/discussion/browser/javascripts/moderation.js @@ -36,6 +36,11 @@ $(row).fadeOut("normal", function () { $(this).remove(); }); + // reload page if all comments have been removed + var comments = $("table#review-comments > tbody > tr"); + if (comments.length === 1) { + location.reload(); + } }, error: function (msg) { alert("Error sending AJAX request:" + target); @@ -62,6 +67,11 @@ $(row).fadeOut("normal", function () { $(this).remove(); }); + // reload page if all comments have been removed + var comments = $("table#review-comments > tbody > tr"); + if (comments.length === 1) { + location.reload(); + } }, error: function (msg) { alert("Error sending AJAX request:" + target); @@ -96,6 +106,11 @@ row.remove(); }); }); + // reload page if all comments have been removed + var comments = $("table#review-comments > tbody > tr"); + if (comments.length <= valArray.length) { + location.reload(); + } }); // reset the bulkaction select selectField.find("option[value='-1']").attr('selected', 'selected'); @@ -139,7 +154,7 @@ error: function (msg) { alert("Error getting full comment text:" + target); } - }); + }); }); });