summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-05-20 07:22:29 -0400
committerDonald Stufft <donald@stufft.io>2013-05-20 07:22:29 -0400
commit9ca3b7a9aae9fd2230179c657e42878eddb817df (patch)
treeca10c0d2246e881daca7346a2a75a05fd830082b /templates
parent0a7f5c43b43c4f1ce13587b7ffc1584044588c68 (diff)
downloaddecorator-9ca3b7a9aae9fd2230179c657e42878eddb817df.tar.gz
Add a bit of javascript to enable a toggle all checkbox
Thanks to Marius Gedminas, Lennart Regebro, and Tres Seaver for their help in deciphering zope.pagetemplate.
Diffstat (limited to 'templates')
-rw-r--r--templates/urls.pt17
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/urls.pt b/templates/urls.pt
index 28f28b8..4907c87 100644
--- a/templates/urls.pt
+++ b/templates/urls.pt
@@ -55,6 +55,12 @@
<th>URL</th>
</tr>
+ <tr>
+ <td><input type="checkbox" onClick="toggle(this)" /></td>
+ <td></td>
+ <td>Toggle All</td>
+ </tr>
+
<tr tal:repeat="url python:app.store.list_description_urls(data['name'])"
tal:attributes="class repeat/url/parity">
<td><input type="checkbox" name="url-ids" tal:attributes="value url/id" /></td>
@@ -86,6 +92,17 @@
<input type="submit" name="submit_new_url" value="Add URL" />
</form>
+<script type="text/javascript">
+ // <![CDATA[
+ function toggle(source) {
+ checkboxes = document.getElementsByName('url-ids');
+ for(var i=0, n=checkboxes.length;i<n;i++) {
+ checkboxes[i].checked = source.checked;
+ }
+ }
+ // ]]>
+</script>
+
</metal:fill>
</html>