From a608c58c4c2b99d6b7c6cd1117d76f84ac08f82b Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 6 Jul 2009 17:30:19 +0000 Subject: [PATCH] use "@@moderate-publish-comment" instead of "content_status_modify" for publishing comments. content_status_modify does not reindex the comment properly. svn path=/plone.app.discussion/trunk/; revision=27839 --- plone/app/discussion/browser/comments.pt | 5 ++-- .../javascripts/reply_to_comment_form.js | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/plone/app/discussion/browser/comments.pt b/plone/app/discussion/browser/comments.pt index e4fdd6c..eee4e60 100644 --- a/plone/app/discussion/browser/comments.pt +++ b/plone/app/discussion/browser/comments.pt @@ -115,10 +115,11 @@ method="get" style="display: inline;" tal:repeat="action reply_dict/actions|nothing" - tal:attributes="action string:${reply/absolute_url}/content_status_modify; + tal:attributes="action string:${reply/absolute_url}/@@moderate-publish-comment; name action/id"> - diff --git a/plone/app/discussion/browser/javascripts/reply_to_comment_form.js b/plone/app/discussion/browser/javascripts/reply_to_comment_form.js index ab37c4f..091ae6e 100644 --- a/plone/app/discussion/browser/javascripts/reply_to_comment_form.js +++ b/plone/app/discussion/browser/javascripts/reply_to_comment_form.js @@ -99,4 +99,28 @@ jq(document).ready(function() { }, }); }); + + /***************************************************************** + * Publish comment. + *****************************************************************/ + jq("input[name='form.button.PublishComment']").click(function(e){ + e.preventDefault(); + var button = jq(this); + var form = jq(this).parent(); + var target = jq(form).attr("action"); + var comment = jq(form).parent() + jq.ajax({ + type: "GET", + url: target, + success: function(msg){ + // fade out row + jq(button).fadeOut("normal", function(){ + jq(form).remove(); + }); + }, + error: function(msg){ + alert("Error sending AJAX request:" + target); + }, + }); + }); }); \ No newline at end of file