seedlot upload with accession synonyms. seedlot upload works to update existing seedlots
[sgn.git] / lib / SGN / View / Mason.pm
blob2d1c4613de7921df5038fa836bc34dd2901bfba1
1 =head1 NAME
3 SGN::View::Mason - Mason View Component for SGN
5 =head1 DESCRIPTION
7 Mason View Component for SGN. This extends Catalyst::View::HTML::Mason.
9 =cut
11 package SGN::View::Mason;
12 use Moose;
13 use Moose::Util::TypeConstraints;
14 use namespace::autoclean;
16 extends 'Catalyst::View::HTML::Mason';
17 with 'Catalyst::Component::ApplicationAttribute';
19 __PACKAGE__->config(
20 globals => ['$c'],
21 template_extension => '.mas',
22 interp_args => {
23 data_dir => SGN->tempfiles_base->subdir('mason'),
24 comp_root => [
25 [ main => SGN->path_to('mason') ],
30 =head1 CONFIGURATION SETTINGS (which are also accessors)
32 =head2 add_comp_root
34 Configurable arrayref of additional Mason component roots. These will
35 be searched before the default ones. Must be absolute paths.
37 =cut
39 # munges the interp_args comp_root to include the add_comp_root
40 # configuration, plus the comp roots for SiteFeatures
41 sub COMPONENT {
42 my ( $class, $c, $args ) = @_;
44 $args = $class->merge_config_hashes( $class->config, $args );
46 # coerce add_comp_root to arrayref
47 if( $args->{add_comp_root} && ! ref $args->{add_comp_root} ) {
48 $args->{add_comp_root} = [ $args->{add_comp_root} ];
51 # add comp roots for features and add_comp_root
52 unshift @{ $args->{interp_args}->{comp_root} }, (
53 # add_comp_root
54 ( map [ additional => $_ ], @{ $args->{add_comp_root} || [] } ),
55 # SiteFeatures
56 ( map [ $_->feature_name, $_->path_to('mason')], $c->features ),
59 return $class->new($c, $args);
62 =head1 FUNCTIONS
64 =head2 $self->component_exists($component)
66 Check if a Mason component exists. Returns 1 if the component exists, otherwise 0.
69 =cut
71 sub component_exists {
72 my ( $self, $component ) = @_;
74 return $self->interp->comp_exists( $component ) ? 1 : 0;
77 =head1 SEE ALSO
79 L<SGN>, L<HTML::Mason>, L<Catalyst::View::HTML::Mason>
81 =head1 AUTHORS
83 Robert Buels, Jonathan "Duke" Leto
85 =head1 LICENSE
87 This library is free software . You can redistribute it and/or modify it under
88 the same terms as perl itself.
90 =cut
92 __PACKAGE__->meta->make_immutable;