X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FView%2FBase.pm;h=5ae1bae6e86216ddaa22ea133d80c84e0e4f3e10;hb=5e09c784983b4a041e81d15e06456e0c16da5bf3;hp=277a0c93d95dcb30db2649acd57db9f1548e7957;hpb=01323f127ddaf8eb9bd9b9d9ea8bcd6a6fd8a49e;p=maypole.git diff --git a/lib/Maypole/View/Base.pm b/lib/Maypole/View/Base.pm index 277a0c9..5ae1bae 100644 --- a/lib/Maypole/View/Base.pm +++ b/lib/Maypole/View/Base.pm @@ -10,29 +10,27 @@ sub new { bless {}, shift } # By default, do nothing. sub paths { my ( $self, $r ) = @_; + warn "paths called with @_"; my $root = $r->config->template_root || $r->get_template_root; if(ref($root) ne 'ARRAY') { $root = [ $root ]; } my @output = (); foreach my $path (@$root) { - push(@output, $path); push(@output, ( $r->model_class && File::Spec->catdir( $path, $r->model_class->table ) ) ); + push(@output, $path); push(@output, File::Spec->catdir( $path, "custom" )); push(@output, File::Spec->catdir( $path, "factory" )); } - return @output; + return grep( $_, @output); } - - - sub vars { my ( $self, $r ) = @_; my $class = $r->model_class; @@ -57,7 +55,7 @@ sub vars { $classmeta->{related_accessors} ||= [ $class->related($r) ]; $classmeta->{moniker} ||= $class->moniker; $classmeta->{plural} ||= $class->plural_moniker; - $classmeta->{cgi} ||= { $class->to_cgi }; + $classmeta->{cgi} ||= { $class->to_cgi } if ($r->build_form_elements); $classmeta->{stringify_column} ||= $class->stringify_column; # User-friendliness facility for custom template writers.