more info cleanup
[MojoFacets.git] / templates / data / table.html.ep
index e38b0e2..d72bbec 100644 (file)
@@ -1,12 +1,46 @@
 % layout 'default';
 
-columns: <%= join(',',@$columns) %>
+<style type="text/css">
+div.filters {
+       position: absolute;
+       top: 0;
+       right: 0;
+       z-index: 10;
+       margin: 0;
+       background: #eee;
+}
+div.filters ul {
+       display: none;
+}
+div.filters:hover ul {
+       display: block;
+}
+</style>
 
-<table>
+<div class=info>
+<b><%= $rows %></b> items 
+
+% my $filters = session('filters');
+% my @filters_active = keys %$filters;
+% if ( @filters_active ) {
+filter 
+%  foreach my $n ( @filters_active ) {
+<a href="<%= url_for( action => 'facet' )->query( remove => $n ) %>"
+       title="<%= join(', ', @{ $filters->{$n} }) %>"><%= $n %></a>
+%  }
+<span class=count><%= $#filters_active + 1 %> active click to remove</span>
+% }
+
+showing <%= $offset + 1 %>-<%= $offset + $limit %>
+
+</div>
+
+<table border=1>
 
 <tr>
 % foreach my $n ( @$columns ) {
-<th><%= $n %></th>
+<th><%= $n %>&nbsp;<a href="<%= url_for( action => 'facet' )->query( name => $n ) %>"><%== $filters->{$n} ? '&diams;' : '&loz;' %></a>
+</th>
 % }
 </tr>
 
@@ -20,4 +54,18 @@ columns: <%= join(',',@$columns) %>
 
 </table>
 
+<div class=pager>
+% foreach my $p ( 0 .. int( $rows / $limit ) ) {
+% my $o = $p * $limit;
+%      if ( $o == $offset ) {
+<b><%= $p + 1 %></b>
+%      } else {
+<a href="<%= url_for( action => 'table' )->query( offset => $p * $limit ) %>"><%= $p + 1 %></a>
+%      }
+% }
+</div>
 
+<ul class=debug>
+<li>rows: <%= $rows %> offset: <%= $offset %> limit: <%= $limit %>
+<li>columns: <%= join(',',@$columns) %>
+</ul>