diff options
author | Donald Stufft <donald@stufft.io> | 2013-05-20 07:22:29 -0400 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2013-05-20 07:22:29 -0400 |
commit | 9ca3b7a9aae9fd2230179c657e42878eddb817df (patch) | |
tree | ca10c0d2246e881daca7346a2a75a05fd830082b /templates | |
parent | 0a7f5c43b43c4f1ce13587b7ffc1584044588c68 (diff) | |
download | decorator-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.pt | 17 |
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> |