Start using the subinclude plugin and splitting things up.
[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     my ($self, $c) = @_;
12     $c->stash(_do_not_mangle_uri_for => 1);
13 }
14
15 sub find : Chained('base') PathPart('') CaptureArgs(1) {
16     my ($self, $c, $repository) = @_;
17     try {
18         $c->stash(Repository => $c->model()->get_repository($repository));
19     }
20     catch {
21         $c->detach('/error_404');
22     };
23 }
24
25 sub summary : Chained('find') PathPart('') Args(0) {}
26
27 sub shortlog : Chained('find') Args(0) {
28     my ($self, $c) = @_;
29     $c->stash(no_wrapper => 1);
30     $c->forward('/shortlog');
31 }
32
33 sub log : Chained('find') Args(0) {
34     my ($self, $c) = @_;
35     $c->stash(template => 'log.tt2');
36     $c->forward('/log');
37 }
38
39 __PACKAGE__->meta->make_immutable;