Skip to content

Commit

Permalink
Include a check all checkbox in folder listings.
Browse files Browse the repository at this point in the history
We do not want to use jQuery here, so we go with plain JS. Unfortunately the compatibility for the `for ... in` statement is not given for IE, so we need to stay with a normal for loop.
  • Loading branch information
sallner authored and dwt committed Jun 12, 2018
1 parent 13a11da commit ff9aadd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/OFS/zpt/main.zpt
Expand Up @@ -35,7 +35,14 @@
tal:condition="ids">
<thead class="thead-light">
<tr>
<th scope="col"></th>
<th scope="col" class="text-right">
<input type="checkbox" id="checkAll"
onclick="(function() {
var checkboxes = document.getElementsByClassName('checkbox-list-item');
for (i = 0; i < checkboxes.length; i++){
checkboxes[i].checked = document.getElementById('checkAll').checked;
}})()">
</th>
<th scope="col">Type</th>
<th scope="col">Id</th>
<th scope="col">Title</th>
Expand All @@ -47,6 +54,7 @@
<tal:ob define="ob python:here.get(id)">
<td class="text-right">
<input type="checkbox"
class="checkbox-list-item"
name="ids:list"
tal:attributes="value id" />
</td>
Expand Down

0 comments on commit ff9aadd

Please sign in to comment.