reply-to-comment view and jquery forms added.
svn path=/plone.app.discussion/trunk/; revision=27128
This commit is contained in:
parent
bda70af828
commit
d8cfdf258d
BIN
plone/app/discussion/browser/images/reply.gif
Normal file
BIN
plone/app/discussion/browser/images/reply.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 336 B |
@ -0,0 +1,34 @@
|
|||||||
|
function createReplyToCommentForm(comment_id) {
|
||||||
|
/*
|
||||||
|
* This function creates a form to reply to a specific comment with
|
||||||
|
* the comment_id given as parameter. It does so by cloneing the existing
|
||||||
|
* commenting form at the end of the page template.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The jQuery id of the reply-to-comment button */
|
||||||
|
var button = "#reply-to-comment-" + comment_id + "-button";
|
||||||
|
|
||||||
|
/* Clone the reply div at the end of the page template that contains
|
||||||
|
* the regular comment form and insert it after the reply button of the
|
||||||
|
* current comment.
|
||||||
|
*/
|
||||||
|
reply_div = jq(".reply").clone();
|
||||||
|
reply_div.insertAfter(button);
|
||||||
|
|
||||||
|
/* Hide the reply button (only hide, because we may want to show it
|
||||||
|
* again if the user hits the cancel button).
|
||||||
|
*/
|
||||||
|
jq(button).css("display", "none");
|
||||||
|
|
||||||
|
/* Fetch the reply form inside the reply div */
|
||||||
|
reply_form = reply_div.find("form");
|
||||||
|
|
||||||
|
/* add a hidden field with the id of the comment */
|
||||||
|
reply_form.append("<input type=\"hidden\" value=\"" + comment_id + "\" name=\"form.reply_to_comment_id\"");
|
||||||
|
|
||||||
|
/* Change the form action @@reply-to-comment */
|
||||||
|
old_action = reply_form.attr("action");
|
||||||
|
new_action = old_action.replace("@@add-comment", "@@reply-to-comment");
|
||||||
|
reply_form.attr("action", new_action);
|
||||||
|
|
||||||
|
}
|
8
plone/app/discussion/profiles/default/jsregistry.xml
Normal file
8
plone/app/discussion/profiles/default/jsregistry.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<object name="portal_javascripts">
|
||||||
|
<javascript
|
||||||
|
id="++resource++plone.app.discussion.javascripts/reply_to_comment_form.js"
|
||||||
|
cacheable="False" compression="safe" cookable="False"
|
||||||
|
enabled="True" expression="" inline="False"
|
||||||
|
/>
|
||||||
|
</object>
|
Loading…
Reference in New Issue
Block a user