From 3de4337e74e51e82889c6b20e2410d38314fd7e0 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 18 Sep 2011 22:49:49 +0200 Subject: [PATCH] offer reload instead of remove for changed files --- lib/MojoFacets/Data.pm | 9 +++++++++ templates/data/index.html.ep | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index d0ee485..eb36419 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -1335,6 +1335,14 @@ sub __loaded_paths { keys %$loaded; } +sub reload { + my $self = shift; + $self->stash( reload => 1 ); + $self->remove; +# $self->_load_path( $self->param('path') ); + $self->redirect_to('/data/load?path=' . $self->param('path') ); +} + sub remove { my $self = shift; my $path = $self->param('path'); @@ -1348,6 +1356,7 @@ sub remove { } else { warn "WARNING: $path unlink ignored"; } + return if $self->stash('reload'); return $self->redirect_to( '/data/load' ); } diff --git a/templates/data/index.html.ep b/templates/data/index.html.ep index d118e83..473cc89 100644 --- a/templates/data/index.html.ep +++ b/templates/data/index.html.ep @@ -19,7 +19,8 @@ <%= $size->{$n} %> % if ( my $size = -s $dump_path->{$n} ) { -<%= $size %> +% my $action = -M $dump_path->{$n} > -M "data/$n" ? 'reload' : 'remove'; +<%= $size %> % } <%= defined $loaded->{$n}->{data} ? $#{ $loaded->{$n}->{data}->{items} } + 1 : '' %> <%= defined $changes->{$n} ? $#{ $changes->{$n} } + 1 : '' %> -- 2.20.1