summaryrefslogtreecommitdiffstats
path: root/new.psgi
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-04-05 04:18:58 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:54 +0200
commitcdc26a69674ea7a3413efce2f8d4e3225c6ab76e (patch)
treecdee5c2c8b40652cdea40becdcc96f13c3a97bc9 /new.psgi
parente680057dd24ea4290096f4420bdd5c354acea024 (diff)
downloadbugzilla-cdc26a69674ea7a3413efce2f8d4e3225c6ab76e.tar.gz
bugzilla-cdc26a69674ea7a3413efce2f8d4e3225c6ab76e.tar.xz
render bugzilla templates using mojo
Diffstat (limited to 'new.psgi')
-rwxr-xr-xnew.psgi22
1 files changed, 21 insertions, 1 deletions
diff --git a/new.psgi b/new.psgi
index 7685a7392..9eb56b370 100755
--- a/new.psgi
+++ b/new.psgi
@@ -19,6 +19,25 @@ use Try::Tiny;
plugin 'PODRenderer';
+app->renderer->add_handler(
+ 'bugzilla' => sub {
+ my ( $renderer, $c, $output, $options ) = @_;
+ my %params;
+
+ # Helpers
+ foreach my $method ( grep {m/^\w+\z/} keys %{ $renderer->helpers } ) {
+ my $sub = $renderer->helpers->{$method};
+ $params{$method} = sub { $c->$sub(@_) };
+ }
+
+ # Stash values
+ $params{$_} = $c->stash->{$_} for grep {m/^\w+\z/} keys %{ $c->stash };
+ $params{self} = $params{c} = $c;
+ Bugzilla->template->process( $options->{template}, \%params, $output )
+ or die Bugzilla->template->error;
+ }
+);
+
app->hook(
around_dispatch => sub {
my ($next, $c) = @_;
@@ -36,7 +55,8 @@ app->hook(
get '/' => sub {
my $c = shift;
my $user = Bugzilla->login(LOGIN_OPTIONAL);
- $c->render( template => 'index', user => $user );
+ $c->stash->{use_login_page} = 1;
+ $c->render( template => 'index.html.tmpl', handler => 'bugzilla', user => $user );
};
app->start;