From: Steve Losh Date: Sat, 31 Jan 2009 07:24:31 +0000 (-0500) Subject: Implemented the single bug view. X-Git-Tag: 1.0.0~53^2~4^2~38 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=46953e63dd929637f67a4d10065a3f28c403dbdf;p=be.git Implemented the single bug view. --- diff --git a/.be/bugs/528b2e84-a944-4628-a18f-cc1def1c7e16/values b/.be/bugs/528b2e84-a944-4628-a18f-cc1def1c7e16/values index 7361121..19aafd2 100644 --- a/.be/bugs/528b2e84-a944-4628-a18f-cc1def1c7e16/values +++ b/.be/bugs/528b2e84-a944-4628-a18f-cc1def1c7e16/values @@ -22,7 +22,7 @@ severity=minor -status=open +status=closed diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/body b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/body new file mode 100644 index 0000000..d13b1b7 --- /dev/null +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/body @@ -0,0 +1 @@ +I agree. (Test message). diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/values b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/values new file mode 100644 index 0000000..4f055dd --- /dev/null +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/values @@ -0,0 +1,28 @@ + + + +Content-type=text/plain + + + + + + +Date=Sat, 31 Jan 2009 06:31:12 +0000 + + + + + + +From=Steve Losh + + + + + + +In-reply-to=d5ffa1c4-f435-4a9a-99f3-2a7bc3072051 + + + diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/body b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/body new file mode 100644 index 0000000..8598e67 --- /dev/null +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/body @@ -0,0 +1 @@ +This will not be incredibly easy. It will require reworking of the repository roots. diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/values b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/values new file mode 100644 index 0000000..f541cad --- /dev/null +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Sat, 31 Jan 2009 06:00:40 +0000 + + + + + + +From=Steve Losh + + + diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/body b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/body new file mode 100644 index 0000000..20dbfd2 --- /dev/null +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/body @@ -0,0 +1,3 @@ +This is a comment. + +With several lines. diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/values b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/values new file mode 100644 index 0000000..759a973 --- /dev/null +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Sat, 31 Jan 2009 06:48:21 +0000 + + + + + + +From=Steve Losh + + + diff --git a/cfbe.py b/cfbe.py index ee77999..8f0342f 100755 --- a/cfbe.py +++ b/cfbe.py @@ -3,10 +3,15 @@ import cherrypy from libbe import bugdir from jinja2 import Environment, FileSystemLoader +from datetime import datetime +def datetimeformat(value, format='%B %d, %Y at %I:%M %p'): + return datetime.fromtimestamp(value).strftime(format) + template_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/templates' env = Environment(loader=FileSystemLoader(template_root)) +env.filters['datetimeformat'] = datetimeformat class WebInterface: """The web interface to CFBE.""" @@ -17,7 +22,7 @@ class WebInterface: self.bd = bugdir.BugDir(root=self.bug_root) self.repository_name = self.bd.root.split('/')[-1] - def get_common_information(self, assignee, target): + def get_common_information(self): possible_assignees = list(set([bug.assigned for bug in self.bd if bug.assigned != None])) possible_assignees.sort(key=unicode.lower) @@ -25,7 +30,8 @@ class WebInterface: possible_targets.sort(key=unicode.lower) return {'possible_assignees': possible_assignees, - 'possible_targets': possible_targets,} + 'possible_targets': possible_targets, + 'repository_name': self.repository_name,} def filter_bugs(self, status, assignee, target): """Filter the list of bugs to return only those desired.""" @@ -60,12 +66,27 @@ class WebInterface: template = env.get_template('list.html') bugs = self.filter_bugs(status, assignee, target) - common_info = self.get_common_information(assignee, target) + common_info = self.get_common_information() return template.render(bugs=bugs, bd=self.bd, label=label, assignees=common_info['possible_assignees'], targets=common_info['possible_targets'], - repository_name=self.repository_name) + repository_name=common_info['repository_name']) + @cherrypy.expose + def bug(self, id=''): + """The page for viewing a single bug.""" + + self.bd.load_all_bugs() + + bug = self.bd.bug_from_shortname(id) + + template = env.get_template('bug.html') + common_info = self.get_common_information() + return template.render(bug=bug, bd=self.bd, + assignees=common_info['possible_assignees'], + targets=common_info['possible_targets'], + repository_name=common_info['repository_name']) + config = '/Users/sjl/Documents/cherryflavoredbugseverywhere/cfbe.config' bug_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/.be' diff --git a/static/style/cfbe.css b/static/style/cfbe.css index ee699b4..987afdf 100644 --- a/static/style/cfbe.css +++ b/static/style/cfbe.css @@ -31,3 +31,11 @@ table { margin-bottom: 1.417em; } tr.stripe { background-color: #f5e5f0; } div#assignees, div#targets { display: none; } + +p.creation-info { color: #888; } +span.detail-field-header { font-weight: 700; width: 7.5em; padding-right: 1em; display: inline-block; text-align: right; } + +div.bug-comment { margin-left: 2em;} +p.bug-comment-body { white-space: pre; margin: 0em 0em 0em 0em; } +p.bug-comment-footer { margin: 0em 0em; color: #888; } +h4.bug-comment-header { margin: 1.5em 0em 0em; } \ No newline at end of file diff --git a/templates/bug.html b/templates/bug.html new file mode 100644 index 0000000..ee359f7 --- /dev/null +++ b/templates/bug.html @@ -0,0 +1,41 @@ +{% extends "base.html" %} + +{% block page_title %} + Bug {{ bd.bug_shortname(bug) }} – {{ bug.summary }} +{% endblock %} + +{% block content %} +

Created on {{ bug.time|datetimeformat }} by {{ bug.creator|e }}

+ +

Bug Details

+

+ Status: + {{ bug.status }}
+ + Severity: + {{ bug.severity }}
+ + Scheduled for: + {{ bug.target }}
+ + Assigned to: + {{ bug.assigned|e }}
+ + Permanent ID: + {{ bug.uuid }}
+

+ +

Summary

+

+ {{ bug.summary }} +

+ +

Comments

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

{{ comment.From|e }} said:

+

{{ comment.body|trim|e }}

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