X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FController%2FRoot.pm;fp=lib%2FGitalist%2FController%2FRoot.pm;h=ddcc83a80cd8c3d5c981a17051733ae8526e09db;hb=f41fc74106e51d8055871cacdc1459be4f61f980;hp=d598c1f9e9caf34c58a02b57b1105ac7457a0829;hpb=1aae440e61b68d1f703a63ead38411f5bb428062;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index d598c1f..ddcc83a 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -68,7 +68,16 @@ Provides some help for the search form. sub search_help : Chained('base') Args(0) {} -sub end : ActionClass('RenderView') {} +sub end : ActionClass('Serialize') { + my ($self, $c) = @_; + # Give repository views the current HEAD. + if ($c->stash->{Repository}) { + $c->stash->{HEAD} = $c->stash->{Repository}->head_hash; + } + if ($c->stash->{data} && blessed $c->stash->{data}) { + $c->stash->{rest} = $c->stash->{data}->pack; + } +} sub error_404 : Action { my ($self, $c) = @_; @@ -76,6 +85,16 @@ sub error_404 : Action { $c->response->body('Page not found'); } +__PACKAGE__->config( + default => 'text/html', + map => { + 'application/json' => [qw/ JSON /], + map { $_ => [qw/ View Default /] } + qw( text/css text/html text/plain + application/atom+xml application/rss+xml application/rss ) + } +); + __PACKAGE__->meta->make_immutable; __END__