1 package Gitalist::Controller::Root;
6 use Gitalist::Utils qw/ age_string /;
8 use namespace::autoclean;
10 BEGIN { extends 'Gitalist::Controller' }
12 __PACKAGE__->config(namespace => '');
14 sub root : Chained('/') PathPart('') CaptureArgs(0) {}
16 sub index : Chained('base') PathPart('') Args(0) {
17 my ( $self, $c ) = @_;
18 $c->stash( search_text => $c->req->param('s') || '' ) # FIXME - XSS?
21 sub base : Chained('/root') PathPart('') CaptureArgs(0) {
24 my $git_version = `git --version`;
27 git_version => $git_version,
28 version => $Gitalist::VERSION,
31 return 'never' unless $_[0];
32 return age_string(time - $_[0]->epoch);
36 my($line) = split /\n/, $cmt;
37 $line =~ s/^(.{70,80}\b).*/$1 \x{2026}/;
40 abridged_description => sub {
41 join(' ', grep { defined } (split / /, shift)[0..10]);
48 Provides some help for the search form.
52 sub search_help : Chained('base') Args(0) {}
54 sub end : ActionClass('RenderView') {}
56 sub error_404 : Action {
58 $c->response->status(404);
59 $c->response->body('Page not found');
62 __PACKAGE__->meta->make_immutable;
68 Gitalist::Controller::Root - Root controller for the application
72 This controller handles all of the root level paths for the application
78 Root of chained actions
82 Populate the header and footer. Perhaps not the best location.
86 Provides the repository listing.
90 Attempt to render a view, if needed.
96 See L<Gitalist> for authors.
100 See L<Gitalist> for the license.