Revert "Change to visit"
[catagits/Gitalist.git] / lib / Gitalist / View / Default.pm
index 2c65caa..b1d4840 100644 (file)
@@ -1,37 +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<Gitalist> 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<Gitalist> for the license.
 
 =cut
-
-__PACKAGE__->config(
-       TEMPLATE_EXTENSION => '.tt2',
-       # Set the location for TT files
-       INCLUDE_PATH       => [ Gitalist->path_to( 'templates' ) ],
-       WRAPPER            => 'default.tt2',
-);
-
-__PACKAGE__->meta->make_immutable(inline_constructor => 0);