another $col_changed cleanup
[MojoFacets.git] / templates / data / items / table.html.ep
index 3f3f9b7..eb18192 100644 (file)
@@ -1,13 +1,17 @@
+<pre class=debug><%= dumper $cols_changed %></pre>
 <table border=1>
 
 <tr>
 % my $commit = param('commit');
 % foreach my $n ( @$columns ) {
-% if ( $cols_changed->{$n} == 2 && ! $commit ) {
-<th class=changed>
+% if ( defined $cols_changed->{$n} && ! $commit ) {
+<th class=<%= $cols_changed->{$n} ? 'changed' : 'used' %>>
 <%= $n %>
 % } else {
 <th>
+% if ( $unique->{$n} ) {
+<span title="unique">&#9997;</span>
+% }
 % if ( session('order') ne $n ) {
 <a href="<%= url_for( action => 'order' )->query( order => $n, sort => 'a' ) %>"><%= $n %></a>
 % } else {
@@ -33,11 +37,12 @@ filter
 % foreach my $row ( @$sorted ) {
 <tr title="<%= $row->{_row_id} %>">
 % foreach my $col ( @$columns ) {
-%  my $class = '';
-%  $class .= ' numeric' if $numeric->{$col};
-%  $class .= ' changed' if $cols_changed->{$col};
-%  $class =~ s/^ / class="/ && $class =~ s/$/"/;
-<td<%== $class %>>
+%  my @class ;
+%  push @class, 'numeric' if $numeric->{$col};
+%  if ( defined $cols_changed->{$col} ) {
+%   push @class, $cols_changed->{$col} ? 'changed' : 'used';
+%  }
+<td class="<%= join(' ',@class) %>">
 %  if ( ref $row->{$col} eq 'ARRAY' ) {
 %   my $last = $#{ $row->{$col} };
 %   foreach ( 0 .. $last ) {
@@ -58,10 +63,16 @@ filter
 
 </table>
 <form id=eval method=post style="<%= $code ? '' : 'display:none' %>">
+
 % my $error = stash('eval_error');
 % if ( $error ) {
 <div class=error><%= $error %></div>
 % }
+
+% if ( $out ) {
+<pre id=out><%= dumper $out %></pre>
+% }
+
 % my $rows = scalar split(/\n/,$code);
 <textarea name=code rows=<%= $rows %>><%= $code %></textarea>
 <input name=test   type=submit value="Test code">
@@ -97,6 +108,11 @@ $(document).ready( function(){
                $(this).parent().hide();
        });
 
+       var $out = $('pre#out');
+       if ( $out.height() > $(window).height() ) {
+               $out.height( $(window).height() / 3 * 2 ).css({ overflow: 'auto' });
+       }
+
        $('a#console').click( function() {
                console.debug('open console');
                var $f = $('form#eval');