503ce43424be4c41e3bd178b57c6a4a0df5f706e
[catagits/Gitalist.git] / lib / Gitalist / View / Default.pm
1 package Gitalist::View::Default;
2 use Moose;
3 use Moose::Autobox;
4 use namespace::autoclean;
5
6 extends 'Catalyst::View::TT';
7 with 'Catalyst::View::Component::SubInclude';
8
9 use Template::Plugin::Cycle;
10
11 __PACKAGE__->config(
12     TEMPLATE_EXTENSION => '.tt2',
13     WRAPPER            => 'wrapper.tt2',
14     subinclude_plugin => 'Visit',
15     keep_stash => 1,
16     render_die => 1,
17 );
18
19 use Template::Stash;
20
21 # define list method to flatten arrayrefs
22 $Template::Stash::LIST_OPS->{ to_path } = sub {
23     my $path = join('%2F', shift->flatten, @_);
24     $path =~ s{/}{%2F}g;
25     return $path;
26 };
27
28 __PACKAGE__->meta->make_immutable(inline_constructor => 0);
29
30 __END__
31
32 =head1 NAME
33
34 Gitalist::View::Default - HTML View
35
36 =head1 DESCRIPTION
37
38 HTML View.
39
40 =head1 AUTHORS
41
42 See L<Gitalist> for authors.
43
44 =head1 LICENSE
45
46 See L<Gitalist> for the license.
47
48 =cut