summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-07-25 07:45:36 +0200
committerDan McGee <dan@archlinux.org>2012-07-25 07:45:36 +0200
commitc1a6a87e23864ea044cb15f76b9dbb16734f08d8 (patch)
treea3f0a2ac4622ee4eab7009c93af8baa4d0d9cf0f
parent24b28a504cabcf077882aa95cfa0edbc6a8d4569 (diff)
downloadarchweb-c1a6a87e23864ea044cb15f76b9dbb16734f08d8.tar.gz
archweb-c1a6a87e23864ea044cb15f76b9dbb16734f08d8.tar.xz
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 <dan@archlinux.org>
-rw-r--r--sitestatic/archweb.js9
-rw-r--r--templates/todolists/view.html16
-rw-r--r--todolists/views.py4
3 files changed, 27 insertions, 2 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js
index e6d7341..6586d31 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 69595e1..35bc944 100644
--- a/templates/todolists/view.html
+++ b/templates/todolists/view.html
@@ -29,16 +29,28 @@
<li><a href="pkgbases/{{ svn_root }}/">{{ svn_root }}</a></li>
{% endfor %}</ul>
- <div class="filter-criteria">
+ <p>{{ list.packages|length }} total todolist package{{ list.packages|pluralize }} found.</p>
+
+ <div class="box filter-criteria">
<h3>Filter Todolist Packages</h3>
<form id="todolist_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 for="id_mine_only" title="Show only packages maintained by me">Only Mine</label>
<input type="checkbox" name="mine_only" id="id_mine_only" value="mine_only"/></div>
<div><label for="id_incomplete" title="Packages not yet completed">Only Incomplete</label>
<input type="checkbox" name="incomplete" id="id_incomplete" value="incomplete"/></div>
<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">{{ list.packages|length }}</span> todolist packages displayed.</div>
</fieldset>
</form>
</div>
@@ -56,7 +68,7 @@
</thead>
<tbody>
{% for pkg in list.packages %}
- <tr class="{% cycle 'odd' 'even' %}{% if user in pkg.pkg.maintainers %} mine{% endif %}">
+ <tr class="{% cycle 'odd' 'even' %}{% if user in pkg.pkg.maintainers %} mine{% endif %} {{ pkg.pkg.arch.name }} {{ pkg.pkg.repo.name|lower }}">
<td>{{ pkg.pkg.arch.name }}</td>
<td>{{ pkg.pkg.repo.name|capfirst }}</td>
<td>{% pkg_details_link pkg.pkg %}</td>
diff --git a/todolists/views.py b/todolists/views.py
index c7ba256..b8d1dae 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...