Move the comment display into it's own template.
authorMatthijs Kooijman <matthijs@stdin.nl>
Fri, 31 Oct 2008 10:30:47 +0000 (11:30 +0100)
committerMatthijs Kooijman <matthijs@stdin.nl>
Fri, 31 Oct 2008 10:30:47 +0000 (11:30 +0100)
templates/influences/influence_comments_block.html [new file with mode: 0644]
templates/influences/influence_detail_block.html

diff --git a/templates/influences/influence_comments_block.html b/templates/influences/influence_comments_block.html
new file mode 100644 (file)
index 0000000..255482a
--- /dev/null
@@ -0,0 +1,38 @@
+{% load i18n %}
+{% load threadedcommentstags %}
+
+{% if comments %}
+    <script type="text/javascript">
+        function showReply(comment_id) {
+            YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'block');
+            YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'none');
+        }
+
+        function hideReply(comment_id) {
+            YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'none');
+            YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'block');
+        }
+    </script>
+
+    {% for comment in comments %}
+        <div style="margin-left: {{ comment.depth }}em;" class="comment{% if not comment.is_public %} private{% endif %}">
+            {{ comment.user }} said:<br/>
+            {% auto_transform_markup comment %}
+                       <p style="display:none;" id="replyLink{{comment.id}}">
+                               <a href="javascript:showReply('{{comment.id}}');">{% trans "Reply to this comment" %}</a>
+                       </p>
+                       <div id="replyForm{{comment.id}}" class="commentReplyForm">
+                               <script type="text/javascript">hideReply('{{comment.id}}');</script>
+                               <form method="post" action="{% url influences_influence_comment_parent object.id,comment.id %}">
+                                       <p><a href="javascript:hideReply('{{comment.id}}');">{% trans "Cancel reply" %}</a></p>
+                                       <table>
+                                       {{ comment.reply_form.as_table }}
+                                       </table>
+                                       <div><input type="submit" value="{% trans "Reply to this comment" %}" /></div>
+                               </form>
+                       </div>
+        </div>
+    {% endfor %}
+{% else %}
+    {% trans "No comments were added yet" %}
+{% endif %}
index d60ac14c1a4a80eaac2c0393eded37dfa213134b..692d0b09ea9f81bb0b4425f4b6745480a8d3ab3d 100644 (file)
 {% endif %}
 </table>
 <p>{{ object.description }}</p>
-<script type="text/javascript">
-       function showReply(comment_id) {
-               YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'block');
-               YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'none');
-       }
-
-       function hideReply(comment_id) {
-               YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'none');
-               YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'block');
-       }
-</script>
                
 <h2>{% trans "Comments" %}</h2>
-{% if comments %}
-    {% for comment in comments %}
-        <div style="margin-left: {{ comment.depth }}em;" class="comment{% if not comment.is_public %} private{% endif %}">
-            {{ comment.user }} said:<br/>
-            {% auto_transform_markup comment %}
-                       <p style="display:none;" id="replyLink{{comment.id}}">
-                               <a href="javascript:showReply('{{comment.id}}');">{% trans "Reply to this comment" %}</a>
-                       </p>
-                       <div id="replyForm{{comment.id}}" class="commentReplyForm">
-                               <script type="text/javascript">hideReply('{{comment.id}}');</script>
-                               <form method="post" action="{% url influences_influence_comment_parent object.id,comment.id %}">
-                                       <p><a href="javascript:hideReply('{{comment.id}}');">{% trans "Cancel reply" %}</a></p>
-                                       <table>
-                                       {{ comment.reply_form.as_table }}
-                                       </table>
-                                       <div><input type="submit" value="{% trans "Reply to this comment" %}" /></div>
-                               </form>
-                       </div>
-        </div>
-    {% endfor %}
-{% else %}
-    {% trans "No comments were added yet" %}
-{% endif %}
+{% include "influences/influence_comments_block.html" %}
 
 <p style="display:none;" id="replyLink"><a href="javascript:showReply('')">Add comment</a></p>
 <div id="replyForm">