Added assignment of bugs to people to web UI
authorAaron Bentley <abentley@panoramicfeedback.com>
Mon, 2 Jan 2006 20:53:32 +0000 (15:53 -0500)
committerAaron Bentley <abentley@panoramicfeedback.com>
Mon, 2 Jan 2006 20:53:32 +0000 (15:53 -0500)
beweb/beweb/controllers.py
beweb/beweb/templates/bugs.kid
beweb/beweb/templates/edit_bug.kid

index b0f13db5d2820cfef929f791e46ce9bc6515a648..cbd0816bfc006c8dd8903b64d757f6466bba51b3 100644 (file)
@@ -84,10 +84,14 @@ class Bug(PrestHandler):
         raise cherrypy.HTTPRedirect(bug_url(bug_data['project'], bug.uuid))
 
     @provide_action("action", "Update")
-    def update(self, bug_data, bug, status, severity, summary, action):
+    def update(self, bug_data, bug, status, severity, summary, assigned, 
+               action):
         bug.status = status
         bug.severity = severity
         bug.summary = summary
+        if assigned == "":
+            assigned = None
+        bug.assigned = assigned
         bug.save()
         raise cherrypy.HTTPRedirect(bug_list_url(bug_data["project"]))
 
index b8b2ff794568d16868a53b22b56fcd09af453ef6..07d8dee3fdbe7c157e2c0ce139dd8b1c71b7d51f 100644 (file)
@@ -2,6 +2,7 @@
 <?python
 from libbe.cmdutil import unique_name
 from beweb.controllers import bug_url, project_url, bug_list_url
+from beweb.config import people
 def row_class(bug):
     if bug.status == "closed":
         return "closed"
@@ -20,7 +21,7 @@ def row_class(bug):
 <h1>Bug list for ${project_name}</h1>
 <table>
 <tr><td>ID</td><td>Status</td><td>Severity</td><td>Assigned To</td><td>Summary</td></tr>
-<div py:for="bug in bugs" py:strip="True"><tr class="${row_class(bug)}" py:if="bug.status != 'closed' or show_closed"><td><a href="${bug_url(project_id, bug.uuid)}">${unique_name(bug, bugs[:])}</a></td><td>${bug.status}</td><td>${bug.severity}</td><td>${bug.assigned}</td><td>${bug.summary}</td></tr>
+<div py:for="bug in bugs" py:strip="True"><tr class="${row_class(bug)}" py:if="bug.status != 'closed' or show_closed"><td><a href="${bug_url(project_id, bug.uuid)}">${unique_name(bug, bugs[:])}</a></td><td>${bug.status}</td><td>${bug.severity}</td><td>${people.get(bug.assigned, bug.assigned)}</td><td>${bug.summary}</td></tr>
 </div>
 </table>
 <a href="${project_url()}">Project list</a>
index 49dbe52cb613552ddb66ef7af96b0d0541b0a5b7..57f1940ad1db097a789697dc6f564735b36203ea 100644 (file)
@@ -3,14 +3,28 @@
 from libbe.bugdir import severity_levels
 from libbe.utility import time_to_str 
 from beweb.controllers import bug_list_url, comment_url
-def select_among(name, options, default):
+from beweb.config import people
+def select_among(name, options, default, display_names=None):
     output = ['<select name="%s">' % name]
     for option in options:
         if option == default:
             selected = ' selected="selected"'
         else:
             selected = ""
-        output.append("<option%s>%s</option>" % (selected, option))
+        if display_names is None:
+            display_name = None
+        else:
+            display_name = display_names.get(option)
+
+        if option is None:
+            option = ""
+        if display_name is None:
+            display_name = option
+            value = ""
+        else:
+            value = ' value="%s"' % option
+        output.append("<option%s%s>%s</option>" % (selected, value, 
+                                                   display_name))
     output.append("</select>")
     return XML("".join(output))
 ?>
@@ -27,7 +41,8 @@ def select_among(name, options, default):
 <form method="post">
 <table>
 <tr><td>Status</td><td>Severity</td><td>Assigned To</td><td>Summary</td></tr>
-<tr><td>${select_among("status", ["open", "closed", "in-progress"], bug.status)}</td><td>${select_among("severity", severity_levels, bug.severity)}</td><td>${bug.assigned}</td><td><input name="summary" value="${bug.summary}" size="80" /></td></tr>
+<tr><td>${select_among("status", ["open", "closed", "in-progress"], bug.status)}</td><td>${select_among("severity", severity_levels, bug.severity)}</td>
+<td>${select_among("assigned", people.keys()+[None], bug.assigned, people)}</td><td><input name="summary" value="${bug.summary}" size="80" /></td></tr>
 </table>
 <div py:for="comment in bug.list_comments()" class="comment">
     <insetbox>