Implemented the single bug view.
authorSteve Losh <steve@stevelosh.com>
Sat, 31 Jan 2009 07:24:31 +0000 (02:24 -0500)
committerSteve Losh <steve@stevelosh.com>
Sat, 31 Jan 2009 07:24:31 +0000 (02:24 -0500)
.be/bugs/528b2e84-a944-4628-a18f-cc1def1c7e16/values
.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/body [new file with mode: 0644]
.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/aea21508-69c2-4d6b-ada1-4fbadac14c56/values [new file with mode: 0644]
.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/body [new file with mode: 0644]
.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/d5ffa1c4-f435-4a9a-99f3-2a7bc3072051/values [new file with mode: 0644]
.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/body [new file with mode: 0644]
.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/comments/f1fd8249-ded3-4e3c-a6ef-967d0a0edcd9/values [new file with mode: 0644]
cfbe.py
static/style/cfbe.css
templates/bug.html [new file with mode: 0644]

index 73611219f99bbffde44d0722ecef1e5053f46fad..19aafd262c3a441cb4a147b83d369c868fcd6c76 100644 (file)
@@ -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 (file)
index 0000000..d13b1b7
--- /dev/null
@@ -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 (file)
index 0000000..4f055dd
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sat, 31 Jan 2009 06:31:12 +0000
+
+
+
+
+
+
+From=Steve Losh <steve@stevelosh.com>
+
+
+
+
+
+
+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 (file)
index 0000000..8598e67
--- /dev/null
@@ -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 (file)
index 0000000..f541cad
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sat, 31 Jan 2009 06:00:40 +0000
+
+
+
+
+
+
+From=Steve Losh <steve@stevelosh.com>
+
+
+
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 (file)
index 0000000..20dbfd2
--- /dev/null
@@ -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 (file)
index 0000000..759a973
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sat, 31 Jan 2009 06:48:21 +0000
+
+
+
+
+
+
+From=Steve Losh <steve@stevelosh.com>
+
+
+
diff --git a/cfbe.py b/cfbe.py
index ee779999f1393fdd558955563feb07ae24edce1a..8f0342f5697ce2d84c8a795532228c2025fb7d1d 100755 (executable)
--- 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'
index ee699b41c60f0626b214207c4bebdf5af0a180e5..987afdf985d20282a0ffe897373c0e39dbcd6b51 100644 (file)
@@ -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 (file)
index 0000000..ee359f7
--- /dev/null
@@ -0,0 +1,41 @@
+{% extends "base.html" %}
+
+{% block page_title %}
+    Bug {{ bd.bug_shortname(bug) }} &ndash; {{ bug.summary }}
+{% endblock %}
+
+{% block content %}
+    <p class="creation-info">Created on {{ bug.time|datetimeformat }} by {{ bug.creator|e }}</p>
+    
+    <h3>Bug Details</h3>
+    <p>
+        <span class="detail-field-header">Status:</span>
+        <span class="detail-field-contents">{{ bug.status }}</span><br />
+        
+        <span class="detail-field-header">Severity:</span>
+        <span class="detail-field-contents">{{ bug.severity }}</span><br />
+        
+        <span class="detail-field-header">Scheduled for:</span>
+        <span class="detail-field-contents">{{ bug.target }}</span><br />
+        
+        <span class="detail-field-header">Assigned to:</span>
+        <span class="detail-field-contents">{{ bug.assigned|e }}</span><br />
+        
+        <span class="detail-field-header">Permanent ID:</span>
+        <span class="detail-field-contents">{{ bug.uuid }}</span><br />
+    </p>
+    
+    <h3>Summary</h3>
+    <p>
+        {{ bug.summary }}
+    </p>
+    
+    <h3>Comments</h3>
+    {% for comment in bug.comments() %}
+        <div class="bug-comment">
+            <h4 class="bug-comment-header">{{ comment.From|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 %}
+{% endblock %}
\ No newline at end of file