Commit | Line | Data |
28d48c6e |
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 | |
16bdb8df |
10 | sub base : Chained('/root') PathPart('') CaptureArgs(0) { |
11 | my ($self, $c) = @_; |
12 | $c->stash(_do_not_mangle_uri_for => 1); |
13 | } |
28d48c6e |
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 | |
16bdb8df |
25 | sub summary : Chained('find') PathPart('') Args(0) {} |
28d48c6e |
26 | |
27 | sub shortlog : Chained('find') Args(0) { |
28 | my ($self, $c) = @_; |
16bdb8df |
29 | $c->stash(no_wrapper => 1); |
28d48c6e |
30 | $c->forward('/shortlog'); |
31 | } |
32 | |
f6a72048 |
33 | sub log : Chained('find') Args(0) { |
34 | my ($self, $c) = @_; |
35 | $c->stash(template => 'log.tt2'); |
36 | $c->forward('/log'); |
37 | } |
38 | |
28d48c6e |
39 | __PACKAGE__->meta->make_immutable; |