change gnuplot with using select element
[MojoFacets.git] / templates / data / items.html.ep
1 % layout 'ui';
2
3 <style type="text/css">
4 table {
5         border-collapse: collapse;
6 }
7 th {
8         white-space: nowrap;
9         background: #eee;
10 }
11 td.numeric {
12         text-align: right;
13 }
14 </style>
15
16 <form class=info>
17 <b><%= $rows %></b> items 
18
19 % my @filters_active = keys %$filters;
20 % if ( @filters_active ) {
21 filter 
22 %  foreach my $n ( @filters_active ) {
23 %  my $title = $#{ $filters->{$n} } + 1;
24 %  $title .= $title > 25 ? ' values' : ': ' . join(', ', @{ $filters->{$n} });
25 <a href="<%= url_for( action => 'facet' )->query( remove => $n ) %>" title="<%= $title %>">
26 <%= $n %></a>
27 %  }
28 <span class=count><%= $#filters_active + 1 %> active click to remove</span>
29 % }
30
31 showing 
32
33 <select name=limit>
34 % foreach my $on_page ( 10,20,50,100,1000 ) {
35 <option <%= $limit == $on_page ? 'selected' : '' %>><%= $on_page %></option>
36 % }
37 </select>
38
39 items
40
41 % if ( $offset + $limit > $rows ) {
42 <span class=count>all</span>
43 % } else {
44 <span class=count><%= $offset + 1 %>-<%= $offset + $limit %></span>
45 % }
46
47 <input type=submit value="refresh">
48
49 % my $export = param('export');
50 % session('export', $export );
51 <input type=checkbox name=export value=1 title="export" <%= $export ? 'checked' : '' %> >
52 % my $timefmt = param('timefmt');
53 % session('timefmt', $timefmt );
54 timefmt: <input name=timefmt value="<%= $timefmt %>">
55
56
57 % if ( $export ) {
58 with:
59 %= select_field with => [qw( points dots lines steps )]
60 <img id=gnuplot src="/gnuplot?timefmt=<%= $timefmt %>&with=<%= param('with') %>">
61 % }
62
63 </form>
64
65 <%= include 'data/items/' . session('show') %>
66
67 <div class=pager>
68 % my $url = url_for( action => 'items' )->query( offset => 0 );
69 % $url =~ s{=0}{=}; # FIXME url_for is very very slow
70 % foreach my $p ( 0 .. int( $rows / $limit ) ) {
71 % my $o = $p * $limit;
72 %       if ( $o == $offset ) {
73 <b><%= $p + 1 %></b>
74 %       } else {
75 <a href="<%= $url . ( $p * $limit ) %>"><%= $p + 1 %></a>
76 %       }
77 % }
78 </div>
79
80 <ul class=debug>
81 <li>rows: <%= $rows %> offset: <%= $offset %> limit: <%= $limit %>
82 <li>columns: <%= join(',',@$columns) %>
83 <li>numeric: <%= dumper $numeric %>
84 <li>order: <%= session('order') %> sort: <%= session('sort') %>
85 %#<li>filters: <%= dumper $filters %>
86 </ul>
87
88 <script type="text/javascript">
89 $(document).ready( function(){
90         $('select[name=limit]').change( function(){
91                 console.debug( 'limit', this );
92                 $(this).closest('form').submit();
93         });
94         $('input[name=export]').change( function(){
95                 console.debug( 'export', this );
96                 if ( this.checked )
97                         $(this).closest('form').submit();
98         });
99         $('select[name=with]').change( function(){
100                 console.debug( 'with', this );
101                 $(this).closest('form').submit();
102         });
103 });
104 </script>