highlight added columns with changed class
[MojoFacets.git] / templates / data / items / table.html.ep
index 3a46164..a71db30 100644 (file)
@@ -1,3 +1,4 @@
+<pre class=debug><%= dumper $cols_added %></pre>
 
 <table border=1>
 
@@ -27,7 +28,7 @@ filter
 % foreach my $row ( @$sorted ) {
 <tr title="<%= $row->{_row_id} %>">
 % foreach my $col ( @$columns ) {
-<td<%= $numeric->{$col} ? ' class=numeric' : '' %>>
+<td<%= $numeric->{$col} ? ' class=numeric' : $cols_added->{$col} ? ' class=changed' : '' %>>
 %  if ( ref $row->{$col} eq 'ARRAY' ) {
 %   my $last = $#{ $row->{$col} };
 %   foreach ( 0 .. $last ) {
@@ -48,12 +49,42 @@ filter
 
 </table>
 
-<form id=eval>
-<textarea name=code>
-<%= param('code') %>
-</textarea>
-<input type=submit value="Execute">
+% if ( $code ) {
+
+<form id=eval method=post>
+% my $error = stash('eval_error');
+% if ( $error ) {
+<div class=error><%= $error %></div>
+% }
+% my $rows = scalar split(/\n/,$code);
+<textarea name=code rows=<%= $rows %>><%= $code %></textarea>
+<input name=test   type=submit value="Test code">
+
+% if ( param('test') ) {
+<a href="">reload original</a>
+%   if ( ! $error ) {
+<input name=commit type=submit value="Commit changes" style="color:red">
+%   }
+% }
+
+<input id=close name=close  type=button value="Close" style="float: right">
 </form>
 
+<script type="text/javascript" src="/js/jquery.textarea_grow.js"></script>
+<script type="text/javascript">
+
+$(document).ready( function(){
+       $('form#eval textarea').textarea_grow();
+       $('input#close').bind('click', function(a,b){
+               console.debug( this,a,b );
+               $.post( document.location, { code: '' } );
+               $(this).parent().hide();
+       });
+});
+
+</script>
+
+% }
+
 <script type="text/javascript" src="/edit_table.js"></script>