Add hidden "next" fields to the comment forms.
[matthijs/projects/xerxes.git] / templates / influences / influence_comments_block.html
index 5392d2f2db3938117e11315dc3f2c1353f2762f0..430ed7135cb11bdb6a0b7bff29fbd64fcf702062 100644 (file)
@@ -1,19 +1,19 @@
 {% 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');
-        }
+<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>
+    function hideReply(comment_id) {
+        YAHOO.util.Dom.setStyle('replyForm' + comment_id, 'display', 'none');
+        YAHOO.util.Dom.setStyle('replyLink' + comment_id, 'display', 'block');
+    }
+</script>
 
+{% 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/>
                                        <table>
                                        {{ comment.reply_form.as_table }}
                                        </table>
-                                       <div><input type="submit" value="{% trans "Reply to this comment" %}" /></div>
+                                       <div>
+                    <input type="hidden" name="next" value="{{ request.path }}" />
+                    <input type="submit" value="{% trans "Reply to this comment" %}" />
+                    <input type="submit" name="preview" value="{% trans "Preview" %}" />
+                    </div>
                                </form>
                        </div>
         </div>
     <table>
     {{ comment_form.as_table }}
     </table>
-    <div><input type="submit" value="{% trans "Add comment" %}" /></div>
-    {# <input type="submit" name="preview" value="{% trans "Preview comment" %}" /></li> #}
+    <div>
+    <input type="hidden" name="next" value="{{ request.path }}" />
+    <input type="submit" value="{% trans "Add comment" %}" />
+    <input type="submit" name="preview" value="{% trans "Preview" %}" />
+    </div>
 </form>
 </div>