diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index 7bb5aac..c089074 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -100,6 +100,15 @@ permission="plone.app.discussion.ReviewComments" /> + + + tbody > tr"); - if (comments.length === 1) { + if (moderate) { + // fade out row + $(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(); + } + } else { + location.reload(); + } + }, + error: function (msg) { // jshint ignore:line + alert("Error sending AJAX request:" + target); + } + }); + }); + + + /********************************************************************** + * Reject a single comment. + **********************************************************************/ + $("input[name='form.button.Reject']").click(function (e) { + e.preventDefault(); + var row = $(this).parent().parent(); + var path = $(row).find("[name='selected_obj_paths:list']").attr("value"); + var auth_key = $('input[name="_authenticator"]').val(); + var target = path + "/@@moderate-reject-comment?_authenticator=" + auth_key; + var moderate = $(this).closest("fieldset").attr("id") == "fieldset-moderate-comments"; + $.ajax({ + type: "GET", + url: target, + success: function (msg) { // jshint ignore:line + if (moderate) { + // fade out row + $(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(); + } + } else { location.reload(); } }, @@ -171,7 +211,8 @@ require([ // jshint ignore:line **********************************************************************/ $(".last-history-entry").each(function() { $(this).load($(this).attr("data-href") + " .historyByLine", function() { - $(this).children(".historyByLine").last().remove(); + let currententry = $(this).children(".historyByLine").first(); + $(this).html(currententry); }); }); diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt index 6f5aea0..e3e56bb 100644 --- a/plone/app/discussion/browser/moderation.pt +++ b/plone/app/discussion/browser/moderation.pt @@ -142,7 +142,16 @@ name="form.button.Publish" i18n:attributes="value label_publish;" tal:attributes="id item/id" - tal:condition="python:item.review_state == 'pending'" + tal:condition="python:item.review_state in ['pending',]" + /> +
-
+

No comments approved

@@ -179,7 +188,7 @@ tal:condition="items_approved_or_rejected" tal:define="batch python:Batch(items_approved_or_rejected, b_size, int(b_start), orphan=1);"> -
+
@@ -190,7 +199,7 @@ Date In Response To Comment - Approved by + Last Action Action @@ -215,8 +224,8 @@ - - + + - + + + diff --git a/plone/app/discussion/profiles/default/workflows/comment_3state_review_workflow/definition.xml b/plone/app/discussion/profiles/default/workflows/comment_3state_review_workflow/definition.xml new file mode 100644 index 0000000..14c53cc --- /dev/null +++ b/plone/app/discussion/profiles/default/workflows/comment_3state_review_workflow/definition.xml @@ -0,0 +1,105 @@ + + + Access contents information + Modify portal content + Reply to item + View + + Submitted, pending review. + + + + Manager + Owner + Reviewer + + + Manager + Owner + Reviewer + + + + + Manager + Owner + Reviewer + + + + Visible to everyone, non-editable. + + + + + Manager + + + + + + + + + + + Approving the comment makes it visible to other users. + Approve + + Review comments + + + + Reject + + Review comments + + + + Previous transition + + + transition/getId|nothing + + + + + + The ID of the user who performed the previous transition + + + user/getUserName + + + + + + Comment about the last transition + + + python:state_change.kwargs.get('comment', '') + + + + + + Provides access to workflow history + + + state_change/getHistory + + + Request review + Review portal content + + + + When the previous transition was performed + + + state_change/getDateTime + + + + +