chiark / gitweb /
Stripy tables.
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 23 Aug 2009 23:54:40 +0000 (00:54 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 23 Aug 2009 23:54:40 +0000 (00:54 +0100)
yarrg/web/lookup
yarrg/web/routetrade
yarrg/web/tabsort

index e3c6770c5fbb51cea557ce41a6589bebe3c971f1..2f4c5c44e1da805232b5d78aa646083e0e5915f1 100755 (executable)
@@ -118,7 +118,16 @@ $ours
 % }
 </%method>
 
-<html><head><title><% ucfirst $ahtml{Query} %> - YARRG</title></head><body>
+<html><head><title><% ucfirst $ahtml{Query} %> - YARRG</title>
+<style type="text/css">
+body {
+  foreground: #000000;
+  background: #ffffff;
+}
+tr.datarow0 { background: #ffffff; }
+tr.datarow1 { background: #eeeeee; }
+</style>
+</head><body>
 
 <a href="<% $m->current_comp()->name() |u %>">YARRG</a> -
  Yet Another Revenue Research Gatherer
index d152eed6a0f6485456340deb404546fcc4cb0620..c135e67bc5b16a69452fec1a559f332eebf1a5cd 100644 (file)
@@ -35,8 +35,6 @@
 ========== TODO ==========
 16:36 <ceb> alpha,byrne,papaya,turtle,jorvik,luthien is my example
 
-16:39 <ceb> Also, maybe colour to highlight the suggested trades?
-
 16:46 <ceb> Also trading plan not functional but I guess you know that :-)
 
 use POST for update.  Hrrm.
@@ -47,8 +45,6 @@ adjustable potential cost of losses (rather than fixed 1e-BIG per league)
 
 max volume/mass
 
-16:38 <ceb> I don't know how hard this is, but can you show only the suggested 
-            trades to start ith and have a button to show all?
 ========== TODO ==========
 
 </%doc>
@@ -438,7 +434,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 %      if ($optimise) {
 <colgroup span=3>
 %      }
-<tr>
+<tr class="spong">
 <th>
 <th<% $cdspan %>>Collect
 <th<% $cdspan %>>Deliver
@@ -477,9 +473,10 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 <th>
 % }
 
-% foreach my $flow (@flows) {
+% foreach my $flowix (0..$#flows) {
+%      my $flow= $flows[$flowix];
 %      my $rowid= "id_row_$flow->{UidShort}";
-<tr id="<% $rowid %>">
+<tr id="<% $rowid %>" class="datarow<% $flowix & 1 %>">
 <td><input type=hidden   name=R<% $flow->{UidShort} %> value="">
     <input type=checkbox name=T<% $flow->{UidShort} %> value=""
        <% $flow->{Suppress} ? '' : 'checked' %> >
@@ -504,7 +501,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 % }
 </table>
 
-<& tabsort, cols => \@cols, table => 'trades',
+<& tabsort, cols => \@cols, table => 'trades', rowclass => 'datarow',
        throw => 'trades_sort', tbrow => 'trades_total' &>
 <&| script &>
   ts_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>;
index db7ac2b48cdd5468e5ccab0fe553719e18c23a38..444bfb56b15f6e1b01e6e2ff74a29c1140209bb8 100644 (file)
@@ -40,6 +40,7 @@ $table => 'ts_table'
 $sortkeys => 'ts_sortkeys'
 $throw => undef
 $tbrow => undef
+$rowclass => undef
 $cols
 </%args>
 
@@ -90,6 +91,14 @@ function <% $sortfn %>(compar) {
     debug('final row '+rowix+' [[ '+row+' ]]');
   }
   newrows.sort(compar);
+%      if (defined $rowclass) {
+  for (var rowix=0; rowix < newrows.length; rowix++) {
+    var row= newrows[rowix];
+    var classname= '<% $rowclass %>'+(rowix % 2);
+    debug('fix row '+rowix+' class '+classname);
+    row.className= classname;
+  }
+%      }
   newrows= newrows.concat(finalrows);
   for (var rowix=0; rowix < newrows.length; rowix++) {
     var row= newrows[rowix];