aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcfbe.py17
-rw-r--r--static/style/cfbe.css5
-rw-r--r--templates/base.html6
-rw-r--r--templates/bug.html15
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');
});
</script>
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 @@
<h3>Comments</h3>
{% for comment in bug.comments() %}
<div class="bug-comment">
- <h4 class="bug-comment-header">{{ comment.From|e }} said:</h4>
+ <h4 class="bug-comment-header">{{ comment.From|striptags|e }} said:</h4>
<p class="bug-comment-body">{{ comment.body|trim|e }}</p>
<p class="bug-comment-footer">on {{ comment.time|datetimeformat }}</p>
</div>
{% endfor %}
+ <form id="add-comment-form" class="vertical" action="/comment" method="post">
+ <fieldset>
+ <input type="hidden" name="id" value="{{ bug.uuid }}" />
+ <div class="field">
+ <label for="add-comment-body">Comment</label>
+ <textarea cols="60" rows="6" id="add-comment-body" name="body"></textarea>
+ </div>
+ <div class="buttons">
+ <button type="submit">Submit</button>
+ </div>
+ </fieldset>
+ </form>
+ <p id="add-comment-link"><a href="" id="add-comment">&#43; Add a comment</a></p>
{% endblock %} \ No newline at end of file