From 122b5aef8aaa94e71ea91facb156a26607575575 Mon Sep 17 00:00:00 2001 From: Steve Losh Date: Sun, 1 Feb 2009 16:09:50 -0500 Subject: [PATCH] I can has commenting! --- cfbe.py | 17 +++++++++++++++++ static/style/cfbe.css | 5 ++++- templates/base.html | 6 ++++++ templates/bug.html | 15 ++++++++++++++- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/cfbe.py b/cfbe.py index b061d88..0a8db77 100755 --- a/cfbe.py +++ b/cfbe.py @@ -52,6 +52,7 @@ class WebInterface: return bugs + @cherrypy.expose def index(self, status='open', assignee='', target=''): self.bd.load_all_bugs() @@ -78,6 +79,7 @@ class WebInterface: statuses=common_info['possible_statuses'], repository_name=common_info['repository_name']) + @cherrypy.expose def bug(self, id=''): """The page for viewing a single bug.""" @@ -94,12 +96,27 @@ class WebInterface: statuses=common_info['possible_statuses'], repository_name=common_info['repository_name']) + @cherrypy.expose def create(self, summary): """The view that handles the creation of a new bug.""" if summary.strip() != '': self.bd.new_bug(summary=summary).save() raise cherrypy.HTTPRedirect('/', status=302) + + + @cherrypy.expose + def comment(self, id, body): + """The view that handles adding a comment.""" + bug = self.bd.bug_from_uuid(id) + shortname = self.bd.bug_shortname(bug) + + if body.strip() != '': + bug.comment_root.new_reply(body=body) + bug.save() + + raise cherrypy.HTTPRedirect('/bug?id=%s' % (shortname,), status=302) + config = '/Users/sjl/Documents/cherryflavoredbugseverywhere/cfbe.config' bug_root = '/Users/sjl/Desktop/be/.be' diff --git a/static/style/cfbe.css b/static/style/cfbe.css index 55bf6b2..2ad25fc 100644 --- a/static/style/cfbe.css +++ b/static/style/cfbe.css @@ -45,4 +45,7 @@ h4.bug-comment-header { margin: 1.5em 0em 0em; } form#create-form { height: 3em; display: none; } form#create-form div.field { } form#create-form input#create-summary { width: 30em; font-weight: 700; } -form#create-form button#create-button { } \ No newline at end of file +form#create-form button#create-button { } + +form#add-comment-form { display: none; margin-top: 1.5em; } +p#add-comment-link {margin-top: 1.5em; } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 40ec10f..c860e65 100644 --- a/templates/base.html +++ b/templates/base.html @@ -36,6 +36,12 @@ e.preventDefault(); }); + $('#add-comment').click(function(e) { + $('#add-comment-link').hide(); + $('#add-comment-form').fadeIn('fast'); + e.preventDefault(); + }); + $('table tr:odd').addClass('stripe'); }); diff --git a/templates/bug.html b/templates/bug.html index ee359f7..2cdbb28 100644 --- a/templates/bug.html +++ b/templates/bug.html @@ -33,9 +33,22 @@

Comments

{% for comment in bug.comments() %}
-

{{ comment.From|e }} said:

+

{{ comment.From|striptags|e }} said:

{{ comment.body|trim|e }}

{% endfor %} +
+
+ +
+ + +
+
+ +
+
+
+ {% endblock %} \ No newline at end of file -- 2.26.2