From: Ian Jackson Date: Sun, 23 Aug 2009 23:54:40 +0000 (+0100) Subject: Stripy tables. X-Git-Tag: 3.4~116 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=c20deee42fbd2d86e976bb6a2e4f8e5f5cf2631b Stripy tables. --- diff --git a/yarrg/web/lookup b/yarrg/web/lookup index e3c6770..2f4c5c4 100755 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -118,7 +118,16 @@ $ours % } -<% ucfirst $ahtml{Query} %> - YARRG +<% ucfirst $ahtml{Query} %> - YARRG + + YARRG - Yet Another Revenue Research Gatherer diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index d152eed..c135e67 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -35,8 +35,6 @@ ========== TODO ========== 16:36 alpha,byrne,papaya,turtle,jorvik,luthien is my example -16:39 Also, maybe colour to highlight the suggested trades? - 16:46 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 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 ========== @@ -438,7 +434,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( % if ($optimise) { % } - + >Collect >Deliver @@ -477,9 +473,10 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( % } -% foreach my $flow (@flows) { +% foreach my $flowix (0..$#flows) { +% my $flow= $flows[$flowix]; % my $rowid= "id_row_$flow->{UidShort}"; - + {UidShort} %> value=""> {UidShort} %> value="" <% $flow->{Suppress} ? '' : 'checked' %> > @@ -504,7 +501,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( % } -<& 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) %>; diff --git a/yarrg/web/tabsort b/yarrg/web/tabsort index db7ac2b..444bfb5 100644 --- a/yarrg/web/tabsort +++ b/yarrg/web/tabsort @@ -40,6 +40,7 @@ $table => 'ts_table' $sortkeys => 'ts_sortkeys' $throw => undef $tbrow => undef +$rowclass => undef $cols @@ -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];