From c1a6a87e23864ea044cb15f76b9dbb16734f08d8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 25 Jul 2012 00:45:36 -0500 Subject: Add arch and repo filter to todolist packages This matches what we do on signoffs. Also beef up the styling a bit and add the dynamically updated package count info. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 9 +++++++++ templates/todolists/view.html | 16 ++++++++++++++-- todolists/views.py | 4 ++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index e6d73414..6586d312 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -287,12 +287,21 @@ function filter_todolist() { if ($('#id_mine_only').is(':checked')) { rows = rows.filter('.mine'); } + /* apply arch and repo filters */ + $('#todolist_filter .arch_filter').add( + '#todolist_filter .repo_filter').each(function() { + if (!$(this).is(':checked')) { + rows = rows.not('.' + $(this).val()); + } + }); + /* more expensive filter because of 'has' call */ if ($('#id_incomplete').is(':checked')) { rows = rows.has('.incomplete'); } /* hide all rows, then show the set we care about */ all_rows.hide(); rows.show(); + $('#filter-count').text(rows.length); /* make sure we update the odd/even styling from sorting */ $('.results').trigger('applyWidgets'); } diff --git a/templates/todolists/view.html b/templates/todolists/view.html index 69595e1a..35bc9446 100644 --- a/templates/todolists/view.html +++ b/templates/todolists/view.html @@ -29,16 +29,28 @@
  • {{ svn_root }}
  • {% endfor %} -
    +

    {{ list.packages|length }} total todolist package{{ list.packages|pluralize }} found.

    + +

    Filter Todolist Packages

    Select filter criteria + {% for arch in arches %} +
    +
    + {% endfor %} + {% for repo in repos %} +
    +
    + {% endfor %}
    +
    +
    {{ list.packages|length }} todolist packages displayed.
    @@ -56,7 +68,7 @@ {% for pkg in list.packages %} - + {{ pkg.pkg.arch.name }} {{ pkg.pkg.repo.name|capfirst }} {% pkg_details_link pkg.pkg %} diff --git a/todolists/views.py b/todolists/views.py index c7ba2560..b8d1dae1 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -53,9 +53,13 @@ def view(request, list_id): # we don't hold onto the result, but the objects are the same here, # so accessing maintainers in the template is now cheap attach_maintainers(tp.pkg for tp in todolist.packages) + arches = set(tp.pkg.arch for tp in todolist.packages) + repos = set(tp.pkg.repo for tp in todolist.packages) return render(request, 'todolists/view.html', { 'list': todolist, 'svn_roots': svn_roots, + 'arches': sorted(arches), + 'repos': sorted(repos), }) # really no need for login_required on this one... -- cgit v1.2.3-55-g3dc8