diff --git a/plone/app/discussion/browser/comments.pt b/plone/app/discussion/browser/comments.pt
index dd01d4b..2629a11 100644
--- a/plone/app/discussion/browser/comments.pt
+++ b/plone/app/discussion/browser/comments.pt
@@ -169,6 +169,11 @@
name="form.button.AddComment"
i18n:attributes="value label_add_comment;" />
+
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 a442ea7..5d30ee2 100644
--- a/plone/app/discussion/browser/javascripts/reply_to_comment_form.js
+++ b/plone/app/discussion/browser/javascripts/reply_to_comment_form.js
@@ -1,12 +1,10 @@
- jq(document).ready(function() {
- /*
- * Show the reply-to-comment button only when Javascript is enabled.
- * Otherwise hide it, since the reply functions rely on jQuery.
- */
- jq(".reply-to-comment-button").css("display" , "block")
+jq(document).ready(function() {
+ /* Show the reply-to-comment button only when Javascript is enabled.
+ * Otherwise hide it, since the reply functions relies on jQuery.
+ */
+ jq(".reply-to-comment-button").css("display" , "block");
});
-
function createReplyToCommentForm(comment_id) {
/*
* This function creates a form to reply to a specific comment with
@@ -40,4 +38,23 @@ function createReplyToCommentForm(comment_id) {
new_action = old_action.replace("@@add-comment", "@@reply-to-comment");
reply_form.attr("action", new_action);
+ /* Add a remove-reply-to-comment Javascript function to remove the form */
+ cancel_reply_button = reply_div.find(".cancelreplytocomment");
+ cancel_reply_button.attr("onclick", "removeReplyToCommentForm(" + comment_id +");")
+
+ /* Show the cancel button in the reply-to-comment form */
+ cancel_reply_button.css("display", "inline")
}
+
+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. */
+ jq("#reply-to-comment-" + comment_id + "-button").css("display", "block");
+
+}
\ No newline at end of file
diff --git a/plone/app/discussion/browser/stylesheets/discussion.css b/plone/app/discussion/browser/stylesheets/discussion.css
index 424ad7e..61cb1bb 100644
--- a/plone/app/discussion/browser/stylesheets/discussion.css
+++ b/plone/app/discussion/browser/stylesheets/discussion.css
@@ -43,3 +43,11 @@
*/
display: none;
}
+
+.cancelreplytocomment {
+ /* Hide the cancel button in the comment form, show it only in the reply form
+ * in order to close it.
+ */
+ display: none;
+}
+