From b9aeabedb105b28793308d6ed2443258bbf68d5a Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Tue, 2 Jun 2009 16:13:44 +0000 Subject: [PATCH] fix the error of showing too much reply forms in the reply-to-comment jquery function. svn path=/plone.app.discussion/trunk/; revision=27263 --- plone/app/discussion/browser/comments.pt | 2 +- .../javascripts/reply_to_comment_form.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plone/app/discussion/browser/comments.pt b/plone/app/discussion/browser/comments.pt index 2629a11..d25a239 100644 --- a/plone/app/discussion/browser/comments.pt +++ b/plone/app/discussion/browser/comments.pt @@ -105,7 +105,7 @@ -
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 5d30ee2..42ed7f8 100644 --- a/plone/app/discussion/browser/javascripts/reply_to_comment_form.js +++ b/plone/app/discussion/browser/javascripts/reply_to_comment_form.js @@ -19,8 +19,12 @@ function createReplyToCommentForm(comment_id) { * the regular comment form and insert it after the reply button of the * current comment. */ - reply_div = jq(".reply").clone(); - reply_div.insertAfter(button); + reply_div = jq("#commenting").clone(true); /* select the clone, not the original */ + reply_div.insertAfter(button, reply_div.show("slow")); + + /* Remove id="reply" attribute, since we use it to uniquely + the main reply form. */ + reply_div.removeAttr("id") /* Hide the reply button (only hide, because we may want to show it * again if the user hits the cancel button). @@ -51,10 +55,10 @@ function removeReplyToCommentForm(comment_id) { * This function removes the reply-to-comment form of a specific comment. */ - /* find the reply-to-comment form and hide it again. */ - jq("#comment-" + comment_id).find(".reply").hide("slow") - - /* Show the reply-to-comment button again. */ + /* Show the reply-to-comment button again. */ jq("#reply-to-comment-" + comment_id + "-button").css("display", "block"); -} \ No newline at end of file + /* Find the reply-to-comment form and hide and remove it again. */ + reply_to_comment_form = jq("#comment-" + comment_id).find(".reply") + reply_to_comment_form.remove(reply_to_comment_form.hide("slow")) +}