]> git.donarmstrong.com Git - debbugs.git/blob - lib/Debbugs/Mojo/Controller/Bug.pm
add xslate helper and serve xslate templates
[debbugs.git] / lib / Debbugs / Mojo / Controller / Bug.pm
1 package Debbugs::Mojo::Controller::Bug;
2
3 use Mojo::Base 'Mojolicious::Controller';
4
5 use Debbugs::Bug;
6
7 sub show {
8     my $c = shift;
9     my $id = $c->stash('bug');
10     my $bug = Debbugs::Bug->new(bug => $id,
11                                 schema => $c->db
12                                );
13     return $c->reply->not_found if not $bug->exists;
14     $c->respond_to(json => {json => $bug->structure},
15                    any => sub {$c->render(template => 'cgi/bugreport',
16                                           handler => 'tx',
17                                           bug => $bug)},
18                   );
19
20 }
21
22 1;