correct remove storable link
[MojoFacets.git] / templates / data / index.html.ep
index 10e202b..d259a0b 100644 (file)
@@ -1,22 +1,48 @@
-% layout 'default';
+% layout 'ui';
+% my $path = session('path');
+
 <h2>Select data file to load</h2>
 
 <form method=post action=/data/load >
 
-<ul>
-% my $current = session('path');
+<input type=submit value="Load">
+
+%= include 'all_checkboxes', add_class_to => 'parent().parent()'
+
+<table>
+<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 ) {
-<li>
+<tr><td>
 <label>
-%  if ( $n eq $current ) {
-<input type=radio disabled> <b><%= $n %></b>
-%  } else {
-<input type=radio name=path value=<%= $n %> > <%= $n %>
-%  }
+<input name=path  type=radio    value="<%= $n %>" <%= $n eq $path && defined $loaded->{$path}->{data} ? 'disabled' : '' %>>
+<%= $n %>
 </label>
+</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="<%= url_for( action => $action )->query([ 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} ) {
+%    my $visible = { map { $_ => 1 } @{ $loaded->{$n}->{columns} } };
+%    foreach my $n ( @{ $loaded->{$n}->{header} } ) {
+<span class="c<%= $filters->{$n} ? ' f' : '' %><%= ! $visible->{$n} ? ' h' : '' %>"><%= $n %></span>
+%    }
+%  }
+</td></tr>
 % }
-</ul>
+</table>
 
 <input type=submit value="Load">
 
 </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>