cancel button added to the reply-to-comment form.
svn path=/plone.app.discussion/trunk/; revision=27262
This commit is contained in:
parent
67b7d4ce49
commit
068583db76
@ -169,6 +169,11 @@
|
|||||||
name="form.button.AddComment"
|
name="form.button.AddComment"
|
||||||
i18n:attributes="value label_add_comment;" />
|
i18n:attributes="value label_add_comment;" />
|
||||||
|
|
||||||
|
<input class="standalone cancelreplytocomment"
|
||||||
|
type="submit"
|
||||||
|
name="form.button.Cancel"
|
||||||
|
value="Cancel"
|
||||||
|
i18n:attributes="value label_cancel;" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="form.submitted" value="1" />
|
<input type="hidden" name="form.submitted" value="1" />
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
jq(document).ready(function() {
|
jq(document).ready(function() {
|
||||||
/*
|
/* Show the reply-to-comment button only when Javascript is enabled.
|
||||||
* Show the reply-to-comment button only when Javascript is enabled.
|
* Otherwise hide it, since the reply functions relies on jQuery.
|
||||||
* Otherwise hide it, since the reply functions rely on jQuery.
|
*/
|
||||||
*/
|
jq(".reply-to-comment-button").css("display" , "block");
|
||||||
jq(".reply-to-comment-button").css("display" , "block")
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function createReplyToCommentForm(comment_id) {
|
function createReplyToCommentForm(comment_id) {
|
||||||
/*
|
/*
|
||||||
* This function creates a form to reply to a specific comment with
|
* 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");
|
new_action = old_action.replace("@@add-comment", "@@reply-to-comment");
|
||||||
reply_form.attr("action", new_action);
|
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");
|
||||||
|
|
||||||
|
}
|
@ -43,3 +43,11 @@
|
|||||||
*/
|
*/
|
||||||
display: none;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user