more info cleanup
[MojoFacets.git] / templates / data / table.html.ep
1 % layout 'default';
2
3 <style type="text/css">
4 div.filters {
5         position: absolute;
6         top: 0;
7         right: 0;
8         z-index: 10;
9         margin: 0;
10         background: #eee;
11 }
12 div.filters ul {
13         display: none;
14 }
15 div.filters:hover ul {
16         display: block;
17 }
18 </style>
19
20 <div class=info>
21 <b><%= $rows %></b> items 
22
23 % my $filters = session('filters');
24 % my @filters_active = keys %$filters;
25 % if ( @filters_active ) {
26 filter 
27 %  foreach my $n ( @filters_active ) {
28 <a href="<%= url_for( action => 'facet' )->query( remove => $n ) %>"
29         title="<%= join(', ', @{ $filters->{$n} }) %>"><%= $n %></a>
30 %  }
31 <span class=count><%= $#filters_active + 1 %> active click to remove</span>
32 % }
33
34 showing <%= $offset + 1 %>-<%= $offset + $limit %>
35
36 </div>
37
38 <table border=1>
39
40 <tr>
41 % foreach my $n ( @$columns ) {
42 <th><%= $n %>&nbsp;<a href="<%= url_for( action => 'facet' )->query( name => $n ) %>"><%== $filters->{$n} ? '&diams;' : '&loz;' %></a>
43 </th>
44 % }
45 </tr>
46
47 % foreach my $row ( @$sorted ) {
48 <tr>
49 % foreach my $col ( @$columns ) {
50 <td><%= ref $row->{$col} eq 'ARRAY' ? join(', ',@{ $row->{$col} }) : $row->{$col} %></td>
51 % }
52 </tr>
53 % }
54
55 </table>
56
57 <div class=pager>
58 % foreach my $p ( 0 .. int( $rows / $limit ) ) {
59 % my $o = $p * $limit;
60 %       if ( $o == $offset ) {
61 <b><%= $p + 1 %></b>
62 %       } else {
63 <a href="<%= url_for( action => 'table' )->query( offset => $p * $limit ) %>"><%= $p + 1 %></a>
64 %       }
65 % }
66 </div>
67
68 <ul class=debug>
69 <li>rows: <%= $rows %> offset: <%= $offset %> limit: <%= $limit %>
70 <li>columns: <%= join(',',@$columns) %>
71 </ul>