Restyle comment display and forms.
[matthijs/projects/xerxes.git] / templates / influences / influence_comments_block.html
1 {% load i18n %}
2 {% load threadedcommentstags %}
3
4 <script type="text/javascript">
5     function showReply(comment_id) {
6         YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'block');
7         YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'none');
8     }
9
10     function hideReply(comment_id) {
11         YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'none');
12         YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'block');
13     }
14 </script>
15
16 {% if comments %}
17     {% for comment in comments %}
18         <div style="margin-left: {{ comment.depth }}em;" class="comment{% if not comment.is_public %} private{% endif %}">
19             <span class="commenter">{{ comment.user }} said:</span>
20             <div class="comment-body">{% auto_transform_markup comment %}</div>
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                     {{ comment.reply_form.comment.label_tag }}
29                     {{ comment.reply_form.comment }}<br/>
30                                         {{ comment.reply_form.is_public }}
31                                         {{ comment.reply_form.is_public.label_tag }}
32                                         <div>
33                     <input type="hidden" name="next" value="{{ request.path }}" />
34                     <input type="submit" value="{% trans "Reply to this comment" %}" />
35                     <input type="submit" name="preview" value="{% trans "Preview" %}" />
36                     </div>
37                                 </form>
38                         </div>
39         </div>
40     {% endfor %}
41 {% else %}
42     {% trans "No comments were added yet" %}
43 {% endif %}
44
45 <p style="display:none;" id="replyLink"><a href="javascript:showReply('')">Add comment</a></p>
46 <div id="replyForm">
47 <script type="text/javascript">hideReply('')</script>
48 <h3>{% trans "Add comment" %}</h3>
49 <form method="post" action="{% url influences_influence_comment object.id %}">
50         <p><a href="javascript:hideReply('')">Cancel comment</a></p>
51     {{ comment_form.comment.label_tag }}
52     {{ comment_form.comment }}<br/>
53     {{ comment_form.is_public }}
54     {{ comment_form.is_public.label_tag }}
55     <div>
56     <input type="hidden" name="next" value="{{ request.path }}" />
57     <input type="submit" value="{% trans "Add comment" %}" />
58     <input type="submit" name="preview" value="{% trans "Preview" %}" />
59     </div>
60 </form>
61 </div>