summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sitestatic/archweb.js20
-rw-r--r--templates/packages/stale_relations.html10
2 files changed, 27 insertions, 3 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js
index 151d0f81..248be7a6 100644
--- a/sitestatic/archweb.js
+++ b/sitestatic/archweb.js
@@ -123,6 +123,26 @@ if (typeof $.tablesorter !== 'undefined') {
});
}
+(function($) {
+ $.fn.enableCheckboxRangeSelection = function() {
+ var lastCheckbox = null;
+ var lastElement = null;
+
+ var spec = this;
+ spec.unbind("click.checkboxrange");
+ spec.bind("click.checkboxrange", function(e) {
+ if (lastCheckbox != null && e.shiftKey) {
+ spec.slice(
+ Math.min(spec.index(lastCheckbox), spec.index(e.target)),
+ Math.max(spec.index(lastCheckbox), spec.index(e.target)) + 1
+ ).attr({checked: e.target.checked ? "checked" : ""});
+ }
+ lastCheckbox = e.target;
+ });
+
+ };
+})(jQuery);
+
/* news/add.html */
function enablePreview() {
$('#news-preview-button').click(function(event) {
diff --git a/templates/packages/stale_relations.html b/templates/packages/stale_relations.html
index 0186d08e..80e912c0 100644
--- a/templates/packages/stale_relations.html
+++ b/templates/packages/stale_relations.html
@@ -23,7 +23,7 @@
<tbody>
{% for relation in inactive_user %}
<tr class="{% cycle 'odd' 'even' %}">
- <td><input type="checkbox" name="relation_id" value="{{ relation.id }}" /></td>
+ <td><input type="checkbox" class="relation-checkbox" name="relation_id" value="{{ relation.id }}" /></td>
<td>{{ relation.pkgbase }}</td>
<td class="wrap">{% for pkg in relation.get_associated_packages %}
<a href="{{ pkg.get_absolute_url }}"
@@ -54,7 +54,7 @@
<tbody>
{% for relation in missing_pkgbase %}
<tr class="{% cycle 'odd' 'even' %}">
- <td><input type="checkbox" name="relation_id" value="{{ relation.id }}" /></td>
+ <td><input type="checkbox" class="relation-checkbox" name="relation_id" value="{{ relation.id }}" /></td>
<td>{{ relation.pkgbase }}</td>
<td>{{ relation.user.get_full_name }}</td>
<td>{{ relation.get_type_display }}</td>
@@ -83,7 +83,7 @@
<tbody>
{% for relation in wrong_permissions %}
<tr class="{% cycle 'odd' 'even' %}">
- <td><input type="checkbox" name="relation_id" value="{{ relation.id }}" /></td>
+ <td><input type="checkbox" class="relation-checkbox" name="relation_id" value="{{ relation.id }}" /></td>
<td>{{ relation.pkgbase }}</td>
<td class="wrap">{% for pkg in relation.get_associated_packages %}
<a href="{{ pkg.get_absolute_url }}"
@@ -114,5 +114,9 @@ $(document).ready(function() {
$('#missing-pkgbase:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false } }, sortList: [[1,0]]});
});
$('#wrong-permissions:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false } }, sortList: [[3,0]]});
+ $('table.results').bind('sortEnd', function() {
+ $('input.relation-checkbox').enableCheckboxRangeSelection();
+ });
+ $('input.relation-checkbox').enableCheckboxRangeSelection();
</script>
{% endblock %}