| 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 => Gitalist->config->{paging}{log} || 25, | ||
| 14 | ); | ||
| 15 | |||
| 16 | my $page = $c->req->param('pg') || 0; | ||
| 17 | $logargs{skip} = abs $page * $logargs{count} | ||
| 18 | if $page; | ||
| 19 | |||
| 20 | $c->stash( | ||
| 21 | page => $page, | ||
| 22 | log_lines => [$repository->list_revs(%logargs)], | ||
| 23 | refs => $repository->references, | ||
| 24 | ); | ||
| 25 | }; | ||
| 26 | |||
| 27 | 1; |