From: Quentin Smith Date: Mon, 28 Dec 2009 01:13:29 +0000 (-0500) Subject: Don't use JavaScript to stripe rows X-Git-Tag: 0.1.5~16 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/6658211de695c3b138f33ad9d8d39bad1581a316 Don't use JavaScript to stripe rows svn path=/trunk/packages/invirt-web/; revision=2796 --- diff --git a/code/static/stripe.js b/code/static/stripe.js deleted file mode 100644 index f1c16de..0000000 --- a/code/static/stripe.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * The general idea is from the following A List Apart article: - * http://www.alistapart.com/articles/zebratables/ - * - * The structure is inspired by the code fragment they supply, but the - * code here is significantly cleaner. It also colors every two lines - * rather than every line, since XVM uses two rows for each item. - */ - -function stripe(table, darkClass, lightClass) { - for (var i = 0; i < table.rows.length; i++ ) { - /* The header row should be light; the next two are dark. */ - if (i%4 == 1 || i%4 == 2) - table.rows[i].className += ' ' + darkClass; - else if (lightClass) - table.rows[i].className += ' ' + lightClass; - } -} diff --git a/code/templates/list.mako b/code/templates/list.mako index c3167cb..d7d320a 100644 --- a/code/templates/list.mako +++ b/code/templates/list.mako @@ -80,8 +80,12 @@ ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoin % endif -<%def name="machineRow(machine)"> - +<%def name="machineRow(machine, dark)"> + % if machine.uptime and installing[machine]: Installing... @@ -139,17 +143,10 @@ ${has_vnc[machine]} Uptime VNC -% for machine in machines: - ${machineRow(machine)} +% for n, machine in enumerate(machines): + ${machineRow(machine, (n%2)==0)} % endfor - -

What is XVM?