3de3bcb12fec3a805972846628416bc95d2465c6
[catagits/Gitalist.git] / lib / Gitalist / Controller / Repository.pm
1 package Gitalist::Controller::Repository;
2
3 use Moose;
4 use Moose::Autobox;
5 use Try::Tiny qw/try catch/;
6 use namespace::autoclean;
7
8 BEGIN { extends 'Catalyst::Controller' }
9
10 sub base : Chained('/root') PathPart('') CaptureArgs(0) {}
11
12 sub find : Chained('base') PathPart('') CaptureArgs(1) {
13     my ($self, $c, $repository) = @_;
14     try {
15         $c->stash(Repository => $c->model()->get_repository($repository));
16     }
17     catch {
18         $c->detach('/error_404');
19     };
20 }
21
22 sub summary : Chained('find') PathPart('') Args(0) {
23     my ($self, $c) = @_;
24     $c->stash(template => 'summary.tt2');
25     $c->forward('/summary');
26
27
28 sub shortlog : Chained('find') Args(0) {
29     my ($self, $c) = @_;
30     $c->stash(template => 'shortlog.tt2');
31     $c->forward('/shortlog');
32 }
33
34 __PACKAGE__->meta->make_immutable;