Move the new comment form to the right template.
[matthijs/projects/xerxes.git] / templates / influences / influence_comments_block.html
1 {% load i18n %}
2 {% load threadedcommentstags %}
3
4 {% if comments %}
5     <script type="text/javascript">
6         function showReply(comment_id) {
7             YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'block');
8             YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'none');
9         }
10
11         function hideReply(comment_id) {
12             YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'none');
13             YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'block');
14         }
15     </script>
16
17     {% for comment in comments %}
18         <div style="margin-left: {{ comment.depth }}em;" class="comment{% if not comment.is_public %} private{% endif %}">
19             {{ comment.user }} said:<br/>
20             {% auto_transform_markup comment %}
21                         <p style="display:none;" id="replyLink{{comment.id}}">
22                                 <a href="javascript:showReply('{{comment.id}}');">{% trans "Reply to this comment" %}</a>
23                         </p>
24                         <div id="replyForm{{comment.id}}" class="commentReplyForm">
25                                 <script type="text/javascript">hideReply('{{comment.id}}');</script>
26                                 <form method="post" action="{% url influences_influence_comment_parent object.id,comment.id %}">
27                                         <p><a href="javascript:hideReply('{{comment.id}}');">{% trans "Cancel reply" %}</a></p>
28                                         <table>
29                                         {{ comment.reply_form.as_table }}
30                                         </table>
31                                         <div><input type="submit" value="{% trans "Reply to this comment" %}" /></div>
32                                 </form>
33                         </div>
34         </div>
35     {% endfor %}
36 {% else %}
37     {% trans "No comments were added yet" %}
38 {% endif %}
39
40 <p style="display:none;" id="replyLink"><a href="javascript:showReply('')">Add comment</a></p>
41 <div id="replyForm">
42 <script type="text/javascript">hideReply('')</script>
43 <h3>{% trans "Add comment" %}</h3>
44 <form method="post" action="{% url influences_influence_comment object.id %}">
45         <p><a href="javascript:hideReply('')">Cancel comment</a></p>
46     <table>
47     {{ comment_form.as_table }}
48     </table>
49     <div><input type="submit" value="{% trans "Add comment" %}" /></div>
50     {# <input type="submit" name="preview" value="{% trans "Preview comment" %}" /></li> #}
51 </form>
52 </div>