From dbda349768b42a54ee265ac87f78536417cbbff3 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Fri, 15 Jul 2011 17:29:29 +0000 Subject: [PATCH] Automatically reload batch moderation page if no comments are left. This refs #11298. svn path=/plone.app.discussion/trunk/; revision=51274 --- CHANGES.txt | 4 ++++ .../browser/javascripts/moderation.js | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) 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); } - }); + }); }); });