cancel button added to the reply-to-comment form.

svn path=/plone.app.discussion/trunk/; revision=27262
This commit is contained in:
Timo Stollenwerk 2009-06-02 15:09:25 +00:00
parent 67b7d4ce49
commit 068583db76
3 changed files with 37 additions and 7 deletions

View File

@ -169,6 +169,11 @@
name="form.button.AddComment"
i18n:attributes="value label_add_comment;" />
<input class="standalone cancelreplytocomment"
type="submit"
name="form.button.Cancel"
value="Cancel"
i18n:attributes="value label_cancel;" />
</div>
<input type="hidden" name="form.submitted" value="1" />

View File

@ -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");
}

View File

@ -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;
}