return bugs
+
@cherrypy.expose
def index(self, status='open', assignee='', target=''):
self.bd.load_all_bugs()
statuses=common_info['possible_statuses'],
repository_name=common_info['repository_name'])
+
@cherrypy.expose
def bug(self, id=''):
"""The page for viewing a single bug."""
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'
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
e.preventDefault();
});
+ $('#add-comment').click(function(e) {
+ $('#add-comment-link').hide();
+ $('#add-comment-form').fadeIn('fast');
+ e.preventDefault();
+ });
+
$('table tr:odd').addClass('stripe');
});
</script>
<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">+ Add a comment</a></p>
{% endblock %}
\ No newline at end of file