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>
This commit is contained in:
parent
24b28a504c
commit
c1a6a87e23
@ -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');
|
||||
}
|
||||
|
@ -29,16 +29,28 @@ <h2>Todo List: {{ list.name }}</h2>
|
||||
<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> </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 @@ <h3>Filter Todolist Packages</h3>
|
||||
</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>
|
||||
|
@ -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...
|
||||
|
Loading…
Reference in New Issue
Block a user