diff options
-rw-r--r-- | beweb/beweb/controllers.py | 10 | ||||
-rw-r--r-- | beweb/beweb/templates/bugs.kid | 18 |
2 files changed, 23 insertions, 5 deletions
diff --git a/beweb/beweb/controllers.py b/beweb/beweb/controllers.py index 9379e24..6c43ecb 100644 --- a/beweb/beweb/controllers.py +++ b/beweb/beweb/controllers.py @@ -59,7 +59,8 @@ class Bug(PrestHandler): 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": @@ -75,6 +76,7 @@ class Bug(PrestHandler): "project_name" : projects[project][0], "bugs" : bugs, "show_closed" : show_closed, + "search" : search, } @provide_action("action", "New bug") @@ -123,10 +125,12 @@ def bug_url(project_id, bug_uuid=None): 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): diff --git a/beweb/beweb/templates/bugs.kid b/beweb/beweb/templates/bugs.kid index 30004fc..d4d783c 100644 --- a/beweb/beweb/templates/bugs.kid +++ b/beweb/beweb/templates/bugs.kid @@ -8,6 +8,15 @@ def row_class(bug): 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'"> @@ -21,13 +30,18 @@ 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>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> |