Skip to content

Commit

Permalink
remove token 'template'
Browse files Browse the repository at this point in the history
  • Loading branch information
yanick committed Feb 11, 2012
1 parent 290a4f9 commit a2a09e8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -6,6 +6,7 @@ Revision history for Dancer-Template-TemplateDeclare
[BUG FIXES]

[ENHANCEMENTS]
- the token 'template' is no longer necessary. Yay!

0.2.0 2012-01-25
[ENHANCEMENTS]
Expand Down
18 changes: 2 additions & 16 deletions lib/Dancer/Template/TemplateDeclare.pm
Expand Up @@ -23,21 +23,13 @@ sub init {

sub default_tmpl_ext { return 'DUMMY'; } # because Dancer requires an ext

sub apply_renderer {
my ( $self, $view, $tokens ) = @_;
sub view_exists { return 1; }

$tokens->{template} = $view;

return $self->SUPER::apply_renderer( $view, $tokens );
}

sub view { $FindBin::Bin }
sub view { return $_[1] }

sub render {
my ($self, $template, $tokens) = @_;

$template = $tokens->{template} || $template;

return Template::Declare->show( $template => $tokens );
}

Expand Down Expand Up @@ -98,12 +90,6 @@ the configuration file, like so:
All the dispatch classes are automatically
loaded behind the scene.
Note that this engine will add I<template> (which holds
the template name) to the tokens. This is a little piece
of chicanery required to get around the default behavior
of L<Dancer::Template::Abstract>, which expects templates
to be file-based.
=head1 USING LAYOUTS
If the layout is set to I<$name>,
Expand Down
1 change: 1 addition & 0 deletions t/apps/Foo/lib/Foo.pm
@@ -1,4 +1,5 @@
package Foo;

use Dancer ':syntax';

use Dancer::Template::TemplateDeclare;
Expand Down
2 changes: 1 addition & 1 deletion t/basic_app.t
@@ -1,7 +1,7 @@
use strict;
use warnings;

use Test::More tests => 3; # last test to print
use Test::More tests => 3;

use lib 't/apps/Foo/lib';

Expand Down

0 comments on commit a2a09e8

Please sign in to comment.