1 package Gitalist::Controller::Root;
3 use namespace::autoclean;
5 BEGIN { extends 'Catalyst::Controller' }
8 # Sets the actions in this controller to be registered with no prefix
9 # so they function identically to actions created in MyApp.pm
11 __PACKAGE__->config->{namespace} = '';
15 Gitalist::Controller::Root - Root Controller for Gitalist
19 [enter your description here]
29 use IO::Capture::Stdout;
30 use File::Slurp qw(slurp);
33 my ( $self, $c ) = @_;
35 my $capture = IO::Capture::Stdout->new();
38 my $action = gitweb::main($c);
43 gitweb::git_header_html();
44 gitweb::git_footer_html();
45 my $output = join '', $capture->read;
46 $c->stash->{content} = $output
47 unless $c->stash->{content};
48 $c->stash->{template} = 'default.tt2';
51 sub index :Path :Args(0) {
52 my ( $self, $c ) = @_;
54 my $order = $c->req->param('order');
55 if($order && $order !~ m/none|project|descr|owner|age/) {
56 die "Unknown order parameter";
59 my @list = $c->model('Git')->projects;
61 die "No projects found";
64 if (-f $c->config->{home_text}) {
65 print "<div class=\"index_include\">\n";
66 print slurp($c->config->{home_text});
71 print $cgi->startform(-method => "get") .
72 "<p class=\"projsearch\">Search:\n" .
73 $cgi->textfield(-name => "s", -value => $c->req->param('searchtext')) . "\n" .
75 $cgi->end_form() . "\n";
77 git_project_list_body(\@list, $order);
82 Attempt to render a view, if needed.
86 sub end : ActionClass('RenderView') {}
94 This library is free software. You can redistribute it and/or modify
95 it under the same terms as Perl itself.
99 __PACKAGE__->meta->make_immutable;