all_checkboxes now work on tables too
[MojoFacets.git] / templates / data / index.html.ep
index d0272b4..92972ec 100644 (file)
@@ -1,20 +1,31 @@
-% layout 'default';
+% layout 'ui';
+% my $path = session('path');
+
 <h2>Select data file to load</h2>
 
 <form method=post action=/data/load >
 
 <input type=submit value="Load">
 
+%= include 'all_checkboxes', add_class_to => 'parent().parent()'
+
 <table>
-<tr><th>name</th><th title="on disk">bytes</th><th>items</th><th title="loaded in memory">m</th><th>columns</th></tr>
+<tr><th rowspan=2>name</th><th colspan=2>size</th><th rowspan=2>items</th><th rowspan=2>changes</th><th rowspan=2 title="loaded in memory">m</th><th colspan=2>columns</th></tr>
+<tr><th>disk</th><th>storable</th></tr>
 % foreach my $n ( @$files ) {
 <tr><td>
 <label>
-<input name=path  type=radio    value="<%= $n %>" <%= defined $loaded->{session('path')}->{data} eq $n ? 'disabled' : '' %>>
+<input name=path  type=radio    value="<%= $n %>" <%= $n eq $path && defined $loaded->{$path}->{data} ? 'disabled' : '' %>>
 <%= $n %>
 </label>
-</td><td align=right><%= $size->{$n} %>
+</td><td class=bytes><%= $size->{$n} %>
+</td><td class=bytes>
+% if ( my $size = -s $dump_path->{$n} ) {
+%  my $action = -M $dump_path->{$n} > -M "data/$n" ? 'reload' : 'remove';
+<a class="<%= $action %>" title="<%= $action %>" href="/data/<%= $action %>?path=<%= $dump_path->{$n} %>;name=<%= $n %>"><%= $size %></a>
+% }
 </td><td align=right><%= defined $loaded->{$n}->{data} ? $#{ $loaded->{$n}->{data}->{items} } + 1 : '' %>
+</td><td align=right><%= defined $changes->{$n} ? $#{ $changes->{$n} } + 1 : '' %>
 </td><td><input name=paths type=checkbox value="<%= $n %>" <%= defined $loaded->{$n}->{stats} ? 'checked' : '' %>>
 </td><td>
 %  if ( defined $loaded->{$n}->{columns} ) {
@@ -31,5 +42,7 @@
 
 </form>
 
+%#<pre class=debug><%= dumper $changes %></pre>
 <pre class=debug><%= dumper $loaded %></pre>
 <pre class=debug><%= dumper $filters %></pre>
+<pre class=debug><%= dumper $dump_path %></pre>