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 committed Feb 7, 2018
1 parent 8598889 commit c32ed33
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/OFS/zpt/main.zpt
Original file line number Diff line number Diff line change
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 c32ed33

Please sign in to comment.