From fa46bc7497abf376eab838b7c499fb62d918cfcc Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Fri, 31 Mar 2006 16:16:53 -0500 Subject: [PATCH] Added bug searching --- beweb/beweb/controllers.py | 10 +++++++--- 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() ?> @@ -21,13 +30,18 @@ def row_class(bug):

Bug list for ${project_name}

-
+
IDStatusSeverityAssigned ToCommentsSummary
${unique_name(bug, bugs[:])}${bug.status}${bug.severity}${people.get(bug.assigned, bug.assigned)}${len(list(bug.iter_comment_ids()))}${bug.summary}
${unique_name(bug, bugs[:])}${bug.status}${bug.severity}${people.get(bug.assigned, bug.assigned)}${len(list(bug.iter_comment_ids()))}${bug.summary}
Project list -Toggle closed +Toggle closed
+
+ + + +
-- 2.26.2