From 366fac5a57abfeab450c0c27a3eac43f5c3c8a19 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 01 2017 21:35:23 +0000 Subject: [PATCH 1/2] Add a way to easily select multiple tags in the issues list and roadmap With this patch, it is trivial to filter issues by selecting one or more tags, clicking on a selected tag will then take it out of the filtering criteria. Bonus point: it also simplifies the logic in the HTML nicely --- diff --git a/pagure/templates/issues.html b/pagure/templates/issues.html index de86ccb..298fbbd 100644 --- a/pagure/templates/issues.html +++ b/pagure/templates/issues.html @@ -124,38 +124,17 @@ {% for tag in tag_list %} - {% if tag.tag in tags %} - {% if status and status != 'Open' %} - - {% else %} - - {% endif %} - {% else %} - {% endif %} {{ tag.tag }} {% endfor %} diff --git a/pagure/templates/roadmap.html b/pagure/templates/roadmap.html index 94eaac7..589b883 100644 --- a/pagure/templates/roadmap.html +++ b/pagure/templates/roadmap.html @@ -132,28 +132,16 @@ {% for tag in tag_list %} - {% if tag in tags %} - - {% else %} - {% endif %} {{ tag }} {% endfor %} diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index 647ab30..ae5e36f 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -572,3 +572,15 @@ def combine_url(url, page, pagetitle, **kwargs): query[pagetitle] = page query.update(kwargs) return url + '?' + '&'.join(['%s=%s' % (k, query[k]) for k in query]) + + +@APP.template_filter('add_or_remove') +def add_or_remove(item, items): + """ Adds the item to the list if it is not in there and remove it + otherwise. + """ + if item in items: + items.remove(item) + else: + items.append(item) + return items From 5578783d42c7da1960c41e4562815c5d7729671e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 01 2017 21:35:23 +0000 Subject: [PATCH 2/2] Allow selecting multiple milestones easily in the UI of the roadmap This ports the behavior we added to the tags to the milestones --- diff --git a/pagure/templates/roadmap.html b/pagure/templates/roadmap.html index 589b883..12d54fe 100644 --- a/pagure/templates/roadmap.html +++ b/pagure/templates/roadmap.html @@ -101,32 +101,19 @@ {% for stone in milestones %} - {% if stone in requested_stones %} - - {{ stone }} - {% else %} - - {{ stone }} - {% endif %} + + {{ stone }} {% endfor %} diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py index 13f79aa..af69637 100644 --- a/pagure/ui/issues.py +++ b/pagure/ui/issues.py @@ -713,7 +713,6 @@ def view_roadmap(repo, username=None, namespace=None): milestones = flask.request.args.getlist('milestone', None) tags = flask.request.args.getlist('tag', None) all_stones = flask.request.args.get('all_stones') - active_milestones = flask.request.args.getlist('active_milestones', None) repo = flask.g.repo