Make filename handling a generic actionrole. Fix more nav uris
[catagits/Gitalist.git] / lib / Gitalist / URIStructure / Commit.pm
1 package Gitalist::URIStructure::Commit;
2 use MooseX::MethodAttributes::Role;
3 use Moose::Autobox;
4 use namespace::autoclean;
5
6 requires 'base';
7
8 after 'base' => sub {
9     my ($self, $c) = @_;
10     confess("No repository in the stash")
11         unless $c->stash->{Repository};
12 };
13
14 sub find : Chained('base') PathPart('') CaptureArgs(1) {
15     my ($self, $c, $sha1part) = @_;
16     # FIXME - Should not be here!
17     $c->stash->{Commit} = $c->stash->{Repository}->get_object($sha1part)
18         or $c->detach('/error404', "Couldn't find a object for '$sha1part' in XXXX!");
19 }
20
21 sub diff : Chained('find') CaptureArgs(0) {}
22
23 sub diff_fancy : Chained('diff') PathPart('') Args(0) {}
24
25 sub diff_plain : Chained('diff') PathPart('plain') Args(0) {}
26
27 sub commit : Chained('find') PathPart('') Args(0) {}
28
29 sub tree : Chained('find') Does('FilenameArgs') Args() {}
30
31 sub blob_plain : Chained('find') Does('FilenameArgs') Args() {}
32
33 sub blob : Chained('find') Does('FilenameArgs') Args() {}
34
35 sub blame : Chained('find') Does('FilenameArgs') Args() {}
36
37 sub history : Chained('find') Does('FilenameArgs') Args() {}
38
39 sub raw : Chained('find') Does('FilenameArgs') Args() {}
40
41 sub shortlog : Chained('find') Does('FilenameArgs') Args() {}
42
43 1;