X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FView%2FDefault.pm;h=b1d484011da799bea712d33ba2c12817171e0dc9;hb=10f3d646dc0d4c48a2d48259a3f81ba840351707;hp=e418acf5f7b5f771b0b2ef8be784e8dcd60a4271;hpb=7e54e579e196c6c545fee1030175f65a111039d4;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/View/Default.pm b/lib/Gitalist/View/Default.pm index e418acf..b1d4840 100644 --- a/lib/Gitalist/View/Default.pm +++ b/lib/Gitalist/View/Default.pm @@ -1,43 +1,47 @@ package Gitalist::View::Default; use Moose; -use Gitalist; # ->path_to +use Moose::Autobox; use namespace::autoclean; extends 'Catalyst::View::TT'; -with 'Catalyst::View::ContentNegotiation::XHTML'; +with 'Catalyst::View::Component::SubInclude'; use Template::Plugin::Cycle; +__PACKAGE__->config( + TEMPLATE_EXTENSION => '.tt2', + WRAPPER => 'wrapper.tt2', + subinclude_plugin => 'SubRequest', + render_die => 1, +); + +use Template::Stash; + +# define list method to flatten arrayrefs +$Template::Stash::LIST_OPS->{ to_path } = sub { + my $path = join('%2F', shift->flatten, @_); + $path =~ s{/}{%2F}g; + return $path; +}; + +__PACKAGE__->meta->make_immutable(inline_constructor => 0); + +__END__ + =head1 NAME -Gitalist::View::Default - Catalyst View +Gitalist::View::Default - HTML View =head1 DESCRIPTION -Catalyst View. +HTML View. -=head1 AUTHOR +=head1 AUTHORS -Dan Brook +See L for authors. =head1 LICENSE -This library is free software. You can redistribute it and/or modify -it under the same terms as Perl itself. +See L for the license. =cut - -__PACKAGE__->config( - TEMPLATE_EXTENSION => '.tt2', - # Set the location for TT files - INCLUDE_PATH => [ Gitalist->path_to( 'templates' ) ], - WRAPPER => 'default.tt2', -); - -# before end => sub { -# my ( $self, $c ) = @_; -# return unless $c->stash->{syntax_highlight}; -# $c->forward( 'View::SyntaxHighlight', $c->stash->{syntax_highlight} ); -# }; - -__PACKAGE__->meta->make_immutable(inline_constructor => 0);