From c1f60d534fbc5496a0e3df2cb7c0d053e5fa40a8 Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Tue, 4 Apr 2006 09:52:50 -0400 Subject: Added support for threaded comments --- beweb/beweb/controllers.py | 16 ++++++++++++++-- beweb/beweb/templates/edit_bug.kid | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'beweb') diff --git a/beweb/beweb/controllers.py b/beweb/beweb/controllers.py index 6c43ecb..74c6a7d 100644 --- a/beweb/beweb/controllers.py +++ b/beweb/beweb/controllers.py @@ -13,9 +13,9 @@ def project_tree(project): except KeyError: raise Exception("Unknown project %s" % project) -def comment_url(project, bug, comment): +def comment_url(project, bug, comment, **kwargs): return turbogears.url("/project/%s/bug/%s/comment/%s" % - (project, bug, comment)) + (project, bug, comment), kwargs) class Comment(PrestHandler): @provide_action("action", "New comment") @@ -27,6 +27,18 @@ class Comment(PrestHandler): raise cherrypy.HTTPRedirect(comment_url(comment=comment.uuid, **comment_data)) + @provide_action("action", "Reply") + def reply_comment(self, comment_data, comment, *args, **kwargs): + bug_tree = project_tree(comment_data['project']) + bug = bug_tree.get_bug(comment_data['bug']) + reply_comment = new_comment(bug, "") + reply_comment.in_reply_to = comment.uuid + reply_comment.save() + reply_data = dict(comment_data) + del reply_data["comment"] + raise cherrypy.HTTPRedirect(comment_url(comment=reply_comment.uuid, + **reply_data)) + @provide_action("action", "Update") def update(self, comment_data, comment, comment_body, *args, **kwargs): comment.body = comment_body diff --git a/beweb/beweb/templates/edit_bug.kid b/beweb/beweb/templates/edit_bug.kid index 774334e..960866d 100644 --- a/beweb/beweb/templates/edit_bug.kid +++ b/beweb/beweb/templates/edit_bug.kid @@ -1,6 +1,6 @@

Edit bug

-
+
StatusSeverityAssigned ToSummary
${select_among("status", active_status+inactive_status, bug.status)}${select_among("severity", severity_levels, bug.severity)} ${select_among("assigned", people.keys()+[None], bug.assigned, people)}
-
+
@@ -81,7 +81,18 @@ def soft_pre(text):
From${comment.From}
Edit + Reply
+
+
+ ${show_comment(child, grandchildren)} +
+
+
+
+ ${show_comment(comment, children)}

-- cgit