First attempt at fixing up the history action.
[catagits/Gitalist.git] / lib / Gitalist / URIStructure / Fragment / WithLog.pm
1 package Gitalist::URIStructure::Fragment::WithLog;
2 use MooseX::MethodAttributes::Role;
3 use namespace::autoclean;
4
5 requires 'log';
6
7 after log => sub {
8     my ($self, $c) = @_;
9     my $repository  = $c->stash->{Repository};
10
11     my %logargs = (
12        sha1   => $c->stash->{Commit}->sha1, # $commit->sha1
13        count  => 25, #Gitalist->config->{paging}{log} || 25,
14     );
15
16     my $page = $c->req->param('pg') || 0;
17     $logargs{skip} = $c->req->param('pg') * $logargs{count}
18         if $c->req->param('pg');
19     $c->stash(
20        log_lines => [$repository->list_revs(%logargs)],
21        refs      => $repository->references,
22     );
23 };
24
25 1;