diff options
Diffstat (limited to 'interfaces')
-rw-r--r-- | interfaces/web/static/style/cfbe.css | 2 | ||||
-rw-r--r-- | interfaces/web/templates/base.html | 17 | ||||
-rw-r--r-- | interfaces/web/web.py | 18 |
3 files changed, 30 insertions, 7 deletions
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 @@ <a href="/?status=closed">Closed</a> <a href="" id="filter-assignee">Assigned to...</a> <a href="" id="filter-target">Scheduled for...</a> + <a href="" id="filter-tag">Tags...</a> </span> <span id="create"> <a href="" id="create-bug">+ Create a new bug</a> @@ -104,5 +111,13 @@ {% endfor %} </ul> </div> - </body> + <div id="tags"> + <ul class="filter-items"> + <li><a href="/?tag=None">All</a></li> + {% for tag in tags %} + <li><a href="/?tag={{ tag }}">{{ tag }}</a></li> + {% endfor %} + </ul> + </div> + </body> </html> 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) |