Make filename handling a generic actionrole. Fix more nav uris
[catagits/Gitalist.git] / lib / Gitalist / Controller / Fragment / Repository.pm
1 package Gitalist::Controller::Fragment::Repository;
2 use Moose;
3 use namespace::autoclean;
4
5 BEGIN { extends 'Gitalist::Controller' }
6 with 'Gitalist::URIStructure::Repository';
7
8 sub base : Chained('/fragment/base') PathPart('') CaptureArgs(0) {}
9
10 after shortlog => sub {
11     my ($self, $c) = @_;
12     my $repository  = $c->stash->{Repository};
13 #    my $commit   =  $self->_get_object($c, $c->req->param('hb'));
14 #    my $filename = $c->req->param('f') || '';
15
16     my %logargs = (
17        sha1   => $repository->head_hash, # $commit->sha1
18        count  => 25, #Gitalist->config->{paging}{log} || 25,
19 #       ($filename ? (file => $filename) : ())
20     );
21
22     my $page = $c->req->param('pg') || 0;
23     $logargs{skip} = $c->req->param('pg') * $logargs{count}
24         if $c->req->param('pg');
25     $c->stash(
26 #       commit    => $commit,
27        log_lines => [$repository->list_revs(%logargs)],
28 #       refs      => $repository->references,
29 #       page      => $page,
30 #       filename  => $filename,
31     );
32 };
33
34 after heads => sub {
35     my ($self, $c) = @_;
36     $c->stash(
37         heads => $c->stash->{Repository}->heads,
38     );
39 };
40
41 =head2 tags
42
43 The current list of tags in the repo.
44
45 =cut
46
47 after tags => sub {
48   my ( $self, $c ) = @_;
49   $c->stash(
50     tags   => $c->stash->{Repository}->tags,
51   );
52 };
53
54 __PACKAGE__->meta->make_immutable;