return self.index(bug_data['project'], bug)
@turbogears.expose(html="beweb.templates.bugs")
- def list(self, project, sort_by=None, show_closed=False, action=None):
+ def list(self, project, sort_by=None, show_closed=False, action=None,
+ search=None):
if action == "New bug":
self.new_bug()
if show_closed == "False":
"project_name" : projects[project][0],
"bugs" : bugs,
"show_closed" : show_closed,
+ "search" : search,
}
@provide_action("action", "New bug")
bug_url += "%s/" % bug_uuid
return turbogears.url(bug_url)
-def bug_list_url(project_id, show_closed=False):
+def bug_list_url(project_id, show_closed=False, search=None):
bug_url = "/project/%s/bug/?show_closed=%s" % (project_id,
str(show_closed))
- return turbogears.url(bug_url)
+ if search is not None:
+ bug_url = "%s&search=%s" % (bug_url, search)
+ return turbogears.url(str(bug_url))
class Project(PrestHandler):
return "closed"
else:
return ""
+
+
+def match(bug, show_closed=False, search=None):
+ if not show_closed and not bug.active:
+ return False
+ elif search is None:
+ return True
+ else:
+ return search.lower() in bug.summary.lower()
?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
py:extends="'master.kid'">
<h1>Bug list for ${project_name}</h1>
<table>
<tr><td>ID</td><td>Status</td><td>Severity</td><td>Assigned To</td><td>Comments</td><td>Summary</td></tr>
-<div py:for="bug in bugs" py:strip="True"><tr class="${row_class(bug)}" py:if="bug.active 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>${len(list(bug.iter_comment_ids()))}</td><td>${bug.summary}</td></tr>
+<div py:for="bug in bugs" py:strip="True"><tr class="${row_class(bug)}" py:if="match(bug, show_closed, search)"><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>${len(list(bug.iter_comment_ids()))}</td><td>${bug.summary}</td></tr>
</div>
</table>
<a href="${project_url()}">Project list</a>
-<a href="${bug_list_url(project_id, not show_closed)}">Toggle closed</a>
+<a href="${bug_list_url(project_id, not show_closed, search)}">Toggle closed</a>
<form action="${bug_list_url(project_id)}" method="post">
<input type="submit" name="action" value="New bug"/>
</form>
+<form action="${bug_list_url(project_id)}" method="get">
+<input type="hidden" name="show_closed" value="False" />
+<input name="search" />
+<input type="submit" name="action" value="Search" />
+</form>
</body>
</html>