add forward slash to contact form path
[sgn.git] / lib / SGN / Feature.pm
blob16649cadd7b6f3587f94b5e5d3908a318eae3276
1 package SGN::Feature;
2 use Moose;
4 use namespace::autoclean;
5 use File::Spec;
7 use MooseX::Types::Path::Class 'Dir';
10 # our context object
11 has 'context' => (
12 documentation => 'our context class',
14 is => 'ro',
15 does => 'SGN::Role::Site::SiteFeatures',
16 required => 1,
17 weak_ref => 1,
19 has 'enabled' => (
20 documentation => 'boolean flag, whether this feature is enabled',
22 is => 'ro',
23 isa => 'Bool',
24 default => 0,
27 sub feature_name {
28 my $self = shift;
29 my $name = ref( $self ) || $self;
30 $name =~ s/.+:://;
31 return lc $name;
34 has 'description' => (
35 documentation => <<'',
36 short plaintext description of the feature, user-visible. May be used in default views for crossreferences and so forth.
38 is => 'ro',
39 isa => 'Str',
40 default => sub { ucfirst shift->feature_name },
43 has 'feature_dir' => (
44 is => 'ro',
45 isa => Dir,
46 coerce => 1,
47 lazy_build => 1,
48 ); sub _build_feature_dir {
49 my $self = shift;
50 return $self->context->path_to( 'features', $self->feature_name )->stringify;
53 sub path_to {
54 my $self = shift;
55 return File::Spec->catfile( $self->feature_dir, @_ );
58 sub tmpdir {
59 my $self = shift;
60 return $self->context->tempfiles_base->subdir( 'features', $self->feature_name );
63 # called on application restart
64 sub setup {
67 # return one or more SGN::SiteFeature::CrossReference objects for the
68 # given input (input can be anything) or nothing if the query is not
69 # handled by this Feature. note that a CrossReference object should
70 # always be returned, it just might be empty
71 sub xrefs {
74 sub apache_conf {
75 return ''
78 __PACKAGE__->meta->make_immutable;