1 package MojoFacets::Changes;
6 use base 'Mojolicious::Controller';
13 my $max = $self->param('max') || 50;
14 my $action_regex = join('|', $self->param('action_filter'));
15 warn "# action_regex $action_regex\n";
20 foreach my $path ( sort { $b cmp $a } glob '/tmp/changes/*' ) {
21 if ( $path =~ m{/((\d+\.\d+)\.data\.(.+))$} ) {
22 my ( $uid, $t, $action ) = ( $1, $2, $3 );
23 $actions->{$action}++;
24 next if $action_regex && $action !~ m/^($action_regex)$/;
25 push @$changes, { uid => $uid, t => $t, action => $action }
28 warn "ignore: $path\n";
32 # Render template "changes/index.html.ep" with message
33 $self->render(message => 'Latest Changes', changes => $changes, actions => $actions );
39 my $uid = $self->param('uid');
40 $self->render( change => retrieve( "/tmp/changes/$uid" ), uid => $uid );
45 my $path = $self->param('path') || $self->session('path');
46 my $edit_path = $self->app->home->rel_dir('data') . '/' . $path . '.edits';
48 foreach my $t ( sort { $b cmp $a } glob $edit_path . '/*' ) {
49 push @$edits, retrieve("$t");
51 $self->render( edits => $edits );