From 489afd8636dbe913a3a704356a158d951cf2c363 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 25 Jan 2010 10:51:27 +0000 Subject: [PATCH] Bugfix #2281226: Moderation View: Comments disappear when hitting the 'Apply' button without choosing a bulk action. svn path=/plone.app.discussion/trunk/; revision=33399 --- .../browser/javascripts/moderation.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plone/app/discussion/browser/javascripts/moderation.js b/plone/app/discussion/browser/javascripts/moderation.js index ed790b6..69325da 100644 --- a/plone/app/discussion/browser/javascripts/moderation.js +++ b/plone/app/discussion/browser/javascripts/moderation.js @@ -82,24 +82,25 @@ jq(document).ready(function() { var params = jq(form).serialize(); var valArray = jq('input:checkbox:checked'); var selectField = jq(form).find("[name='form.select.BulkAction']"); - if (valArray.length) { + if (selectField.val() == '-1') { + // XXX: translate message + alert("You haven't selected a bulk action. Please select one."); + } else if (valArray.length == 0) { + // XXX: translate message + alert("You haven't selected any comment for this bulk action. Please select at least one comment."); + } else { jq.post(target, params, function(data) { valArray.each(function () { - /* Remove all selected lines. */ + /* Remove all selected lines. */ var row = jq(this).parent().parent(); row.fadeOut("normal", function() { row.remove(); }); }); }); - } else { - // The user has submitted a bulk action, but no comment - // was selected. - // Todo: nicer and translated message - alert("You haven't selected anything for this bulk action."); + // reset the bulkaction select + selectField.find("option[value='-1']").attr( 'selected', 'selected' ); } - // reset the bulkaction select - selectField.find("option[value='-1']").attr( 'selected', 'selected' ); }); }); \ No newline at end of file