From: Israel Basurto Date: Sat, 24 Mar 2012 12:22:11 +0000 (+0100) Subject: Add tag filter on the web interface X-Git-Tag: 1.1.0~147 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=89b03d84bca6b65cf9afed3c5e2f614c23294a57;p=be.git Add tag filter on the web interface --- diff --git a/interfaces/web/static/style/cfbe.css b/interfaces/web/static/style/cfbe.css index c5f726e..2d7b90b 100644 --- a/interfaces/web/static/style/cfbe.css +++ b/interfaces/web/static/style/cfbe.css @@ -106,7 +106,7 @@ tr.stripe { background-color: #fcecf8; } -div#assignees, div#targets { +div#assignees, div#targets, div#tags { display: none; } diff --git a/interfaces/web/templates/base.html b/interfaces/web/templates/base.html index 9666d3e..9c7c7ed 100644 --- a/interfaces/web/templates/base.html +++ b/interfaces/web/templates/base.html @@ -32,6 +32,12 @@ e.preventDefault(); }); + $('#filter-tag').click(function(e) { + $('#filter-pane').html($('#tags').html()); + $('#filter-pane').fadeIn('fast'); + e.preventDefault(); + }); + $('#create-bug').click(function(e) { $('#create-bug').hide(); $('#create-form').fadeIn('fast'); @@ -56,6 +62,7 @@ Closed Assigned to... Scheduled for... + Tags... + Create a new bug @@ -104,5 +111,13 @@ {% endfor %} - +
+
    +
  • All
  • + {% for tag in tags %} +
  • {{ tag }}
  • + {% endfor %} +
+
+ diff --git a/interfaces/web/web.py b/interfaces/web/web.py index a99758c..e50c0b1 100644 --- a/interfaces/web/web.py +++ b/interfaces/web/web.py @@ -11,7 +11,7 @@ from libbe.command.target import add_target, remove_target from libbe.command.target import bug_from_target_summary, bug_target from libbe.command.util import bug_comment_from_user_id from libbe.storage.util import settings_object - +import libbe.command.tag EMPTY = settings_object.EMPTY @@ -57,15 +57,19 @@ class WebInterface: 'possible_targets': possible_targets, 'possible_statuses': possible_statuses, 'possible_severities': possible_severities, + 'tags': libbe.command.tag.get_all_tags(self.bd), 'repository_name': self.repository_name,} - def filter_bugs(self, status, assignee, target): + def filter_bugs(self, status, assignee, target, tag): """Filter the list of bugs to return only those desired.""" bugs = [bug for bug in self.bd if bug.status in status] if assignee != '': assignee = None if assignee == 'None' else assignee bugs = [bug for bug in bugs if bug.assigned == assignee] + + if tag != '' and tag!= 'None': + bugs = [bug for bug in bugs if tag in libbe.command.tag.get_tags(bug)] if target != '': target = None if target == 'None' else target @@ -79,11 +83,12 @@ class WebInterface: return [] bugs = [bug for bug in get_blocked_by(self.bd, targetbug) if bug.active] + return bugs @cherrypy.expose - def index(self, status='open', assignee='', target=''): + def index(self, status='open', assignee='', target='', tag=''): """The main bug page. Bugs can be filtered by assignee or target. The bug database will be reloaded on each visit.""" @@ -102,9 +107,11 @@ class WebInterface: else ' Assigned to %s' % (assignee,) if target != '': label += ' Currently Unscheduled' if target == 'None' \ - else ' Scheduled for %s' % (target,) + else ' Scheduled for %s' % (target,) + if tag != '' and tag != 'None': + label += ' Tagged %s' % (tag,) - bugs = self.filter_bugs(status, assignee, target) + bugs = self.filter_bugs(status, assignee, target, tag) if len(bugs) == 0: template = self.env.get_template('empty-list.html') else: @@ -117,6 +124,7 @@ class WebInterface: statuses=common_info['possible_statuses'], severities=common_info['possible_severities'], repository_name=common_info['repository_name'], + tags=common_info['tags'], urlencode=urlencode)