From: Matthijs Kooijman Date: Sat, 26 Jul 2008 11:09:20 +0000 (+0200) Subject: * Enable threaded comments for influences. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=6e0ad555b25c2d9f3f28726f797edb3a51783af2;p=matthijs%2Fprojects%2Fxerxes.git * Enable threaded comments for influences. --- diff --git a/influences/views.py b/influences/views.py index fec38f3..ea07c70 100644 --- a/influences/views.py +++ b/influences/views.py @@ -7,6 +7,8 @@ from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponseForbidden from django.views.generic.list_detail import object_detail, object_list +from threadedcomments.models import ThreadedComment +from threadedcomments.forms import ThreadedCommentForm from xerxes.influences.models import Character from xerxes.influences.models import Influence from xerxes.tools.forms import ContextModelForm @@ -103,6 +105,11 @@ def influence_detail(request, object_id): # Don't show other player's influences if (o.character.player != request.user): return HttpResponseForbidden("Forbidden -- Trying to view influences of somebody else's character") - return render_to_response('influences/influence_detail.html', {'object' : o}, RequestContext(request)) + context = { + 'object' : o, + 'comments' : ThreadedComment.public.get_tree(o), + 'comment_form' : ThreadedCommentForm(), + } + return render_to_response('influences/influence_detail.html', context, RequestContext(request)) # vim: set sts=4 sw=4 expandtab: diff --git a/templates/influences/influence_detail_block.html b/templates/influences/influence_detail_block.html index d2c1c3a..cc78c47 100644 --- a/templates/influences/influence_detail_block.html +++ b/templates/influences/influence_detail_block.html @@ -1,4 +1,5 @@ {% load i18n %} +{% load threadedcommentstags %}

{{ object.summary }}

@@ -9,3 +10,55 @@ {% endif %}

{{ object.description }}

+ + +

{% trans "Comments" %}

+{% if comments %} + {% for comment in comments %} +
+ {{ comment.user }} said:
+ {% auto_transform_markup comment %} + +
+ +
+

Cancel reply

+
    + + {{ comment.get_reply_form.as_table }} +
    + +
+
+
+
+ {% endfor %} +{% else %} + {% trans "No comments were added yet" %} +{% endif %} + + +
+ +

{% trans "Add comment" %}

+
+

Cancel comment

+
    + + {{ comment_form.as_table }} +
    + + +
+
+