Start working out a new URI structure - currently just delegating back to the 'normal...
Tomas Doran [Sun, 17 Jan 2010 18:11:47 +0000 (18:11 +0000)]
lib/Gitalist/Controller/Repository.pm [new file with mode: 0644]

diff --git a/lib/Gitalist/Controller/Repository.pm b/lib/Gitalist/Controller/Repository.pm
new file mode 100644 (file)
index 0000000..3de3bcb
--- /dev/null
@@ -0,0 +1,34 @@
+package Gitalist::Controller::Repository;
+
+use Moose;
+use Moose::Autobox;
+use Try::Tiny qw/try catch/;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller' }
+
+sub base : Chained('/root') PathPart('') CaptureArgs(0) {}
+
+sub find : Chained('base') PathPart('') CaptureArgs(1) {
+    my ($self, $c, $repository) = @_;
+    try {
+        $c->stash(Repository => $c->model()->get_repository($repository));
+    }
+    catch {
+        $c->detach('/error_404');
+    };
+}
+
+sub summary : Chained('find') PathPart('') Args(0) {
+    my ($self, $c) = @_;
+    $c->stash(template => 'summary.tt2');
+    $c->forward('/summary');
+} 
+
+sub shortlog : Chained('find') Args(0) {
+    my ($self, $c) = @_;
+    $c->stash(template => 'shortlog.tt2');
+    $c->forward('/shortlog');
+}
+
+__PACKAGE__->meta->make_immutable;