summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-09-15 09:14:36 -0500
committerDan McGee <dan@archlinux.org>2012-09-15 09:14:36 -0500
commita2034fc80d4e73816502537f8dfe864ab4ef8db3 (patch)
treec8ae7ecffed0f959dffc28b65ff0595c21aa0431
parentdfbf7cdd4c273f2b1f3c1c79b97149d37e63e028 (diff)
Add JS-based filtering to the developer reports
This can use the todolist filtering functions we made more generic in a previous commit. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--devel/views.py4
-rw-r--r--templates/devel/packages.html30
2 files changed, 32 insertions, 2 deletions
diff --git a/devel/views.py b/devel/views.py
index 5406974e..23ff9f74 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -271,11 +271,15 @@ def report(request, report_name, username=None):
else:
raise Http404
+ arches = set(pkg.arch for pkg in packages)
+ repos = set(pkg.repo for pkg in packages)
context = {
'all_maintainers': maints,
'title': title,
'maintainer': user,
'packages': packages,
+ 'arches': sorted(arches),
+ 'repos': sorted(repos),
'column_names': names,
'column_attrs': attrs,
}
diff --git a/templates/devel/packages.html b/templates/devel/packages.html
index ac368124..4e1381ab 100644
--- a/templates/devel/packages.html
+++ b/templates/devel/packages.html
@@ -13,7 +13,28 @@
{% if maintainer %}This report only includes packages maintained by
{{ maintainer.get_full_name }} ({{ maintainer.username }}).{% endif %}
</p>
- <table class="results">
+
+ <div class="box filter-criteria">
+ <h3>Filter Packages</h3>
+ <form id="report_filter" method="post" action=".">
+ <fieldset>
+ <legend>Select filter criteria</legend>
+ {% for arch in arches %}
+ <div><label for="id_arch_{{ arch.name }}" title="Architecture {{ arch.name }}">Arch {{ arch.name }}</label>
+ <input type="checkbox" name="arch_{{ arch.name }}" id="id_arch_{{ arch.name }}" class="arch_filter" value="{{ arch.name }}" checked="checked"/></div>
+ {% endfor %}
+ {% for repo in repos %}
+ <div><label for="id_repo_{{ repo.name|lower }}" title="Target Repository {{ repo.name }}">[{{ repo.name|lower }}]</label>
+ <input type="checkbox" name="repo_{{ repo.name|lower }}" id="id_repo_{{ repo.name|lower }}" class="repo_filter" value="{{ repo.name|lower }}" checked="checked"/></div>
+ {% endfor %}
+ <div ><label>&nbsp;</label><input title="Reset search criteria" type="button" id="criteria_reset" value="Reset"/></div>
+ <div class="clear"></div>
+ <div id="filter-info"><span id="filter-count">{{ packages|length }}</span> packages displayed.</div>
+ </fieldset>
+ </form>
+ </div>
+
+ <table id="dev-report-results" class="results">
<thead>
<tr>
<th>Arch</th>
@@ -31,7 +52,7 @@
</thead>
<tbody>
{% for pkg in packages %}
- <tr class="{% cycle pkgr2,pkgr1 %}">
+ <tr class="{% cycle pkgr2,pkgr1 %} {{ pkg.arch.name }} {{ pkg.repo.name|lower }}">
<td>{{ pkg.arch.name }}</td>
<td>{{ pkg.repo.name|capfirst }}</td>
<td>{% pkg_details_link pkg %}</td>
@@ -57,6 +78,11 @@
<script type="text/javascript">
$(document).ready(function() {
$(".results").tablesorter({widgets: ['zebra']});
+ filter_func = function() { filter_pkgs_list('#report_filter', '#dev-report-results tbody'); };
+ $('#report_filter input').change(filter_func);
+ $('#criteria_reset').click(function() { filter_pkgs_reset(filter_func); });
+ // fire function on page load to ensure the current form selections take effect
+ filter_func();
});
</script>
{% endblock %}