#warn "__commit_path_code $path $i ",dump( $update );
}
+# uses templates/admin.html.ep
+sub _switch_dataset {
+ my $self = shift;
+
+ my $datasets;
+
+ foreach my $path ( keys %$loaded ) {
+ next unless exists $loaded->{$path}->{data};
+ push @$datasets, $path;
+ }
+
+ warn "# datasets ",dump($datasets);
+
+ $self->stash( 'datasets' => $datasets );
+}
+
sub items {
my $self = shift;
+ $self->_switch_dataset;
+
if ( my $show = $self->param('id') ) {
$self->param('show', $show);
warn "show $show\n";
<div class=admin>
+% if ( my $datasets = stash('datasets' ) ) {
+<form action=/data/load id="switch_dataset" style="display: inline">
+<select name="path">
+% foreach my $path ( @$datasets ) {
+<option <%= session('path') eq $path ? 'selected="selected"' : '' %> ><%= $path %></option>
+% }
+</select>
+% foreach my $path ( @$datasets ) {
+<input name=paths type=hidden value="<%= $path %>">
+% }
+</form>
+<script>
+$(document).ready( function() {
+ $('#switch_dataset').change( function() {
+ console.log( 'switch_dataset', this );
+ $(this).submit();
+ });
+ console.debug('installed switch_dataset' );
+});
+</script>
+% } else {
+<tt><%= session('path') %>
+% }
+
<a href="<%= url_for( controller => 'data', action => 'index', id => 0 ) %>">load</a>
<a href="<%= url_for( controller => 'data', action => 'columns', id => 0 ) %>">columns</a>
·