change gnuplot with using select element
[MojoFacets.git] / templates / data / items.html.ep
index 5ab1e0d..340461e 100644 (file)
@@ -1,4 +1,4 @@
-% layout 'default';
+% layout 'ui';
 
 <style type="text/css">
 table {
@@ -16,13 +16,14 @@ td.numeric {
 <form 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>
+%  my $title = $#{ $filters->{$n} } + 1;
+%  $title .= $title > 25 ? ' values' : ': ' . join(', ', @{ $filters->{$n} });
+<a href="<%= url_for( action => 'facet' )->query( remove => $n ) %>" title="<%= $title %>">
+<%= $n %></a>
 %  }
 <span class=count><%= $#filters_active + 1 %> active click to remove</span>
 % }
@@ -45,17 +46,33 @@ items
 
 <input type=submit value="refresh">
 
+% my $export = param('export');
+% session('export', $export );
+<input type=checkbox name=export value=1 title="export" <%= $export ? 'checked' : '' %> >
+% my $timefmt = param('timefmt');
+% session('timefmt', $timefmt );
+timefmt: <input name=timefmt value="<%= $timefmt %>">
+
+
+% if ( $export ) {
+with:
+%= select_field with => [qw( points dots lines steps )]
+<img id=gnuplot src="/gnuplot?timefmt=<%= $timefmt %>&with=<%= param('with') %>">
+% }
+
 </form>
 
-<%= include 'data/items/' . session('show'), filters => $filters %>
+<%= include 'data/items/' . session('show') %>
 
 <div class=pager>
+% my $url = url_for( action => 'items' )->query( offset => 0 );
+% $url =~ s{=0}{=}; # FIXME url_for is very very slow
 % foreach my $p ( 0 .. int( $rows / $limit ) ) {
 % my $o = $p * $limit;
 %      if ( $o == $offset ) {
 <b><%= $p + 1 %></b>
 %      } else {
-<a href="<%= url_for( action => 'items' )->query( offset => $p * $limit ) %>"><%= $p + 1 %></a>
+<a href="<%= $url . ( $p * $limit ) %>"><%= $p + 1 %></a>
 %      }
 % }
 </div>
@@ -65,4 +82,23 @@ items
 <li>columns: <%= join(',',@$columns) %>
 <li>numeric: <%= dumper $numeric %>
 <li>order: <%= session('order') %> sort: <%= session('sort') %>
+%#<li>filters: <%= dumper $filters %>
 </ul>
+
+<script type="text/javascript">
+$(document).ready( function(){
+       $('select[name=limit]').change( function(){
+               console.debug( 'limit', this );
+               $(this).closest('form').submit();
+       });
+       $('input[name=export]').change( function(){
+               console.debug( 'export', this );
+               if ( this.checked )
+                       $(this).closest('form').submit();
+       });
+       $('select[name=with]').change( function(){
+               console.debug( 'with', this );
+               $(this).closest('form').submit();
+       });
+});
+</script>