Catalyst::Helper::View::Enzyme::TT - Helper for Enzyme::TT Views


Catalyst-Enzyme documentation Contained in the Catalyst-Enzyme distribution.

Index


Code Index:

NAME

Top

Catalyst::Helper::View::Enzyme::TT - Helper for Enzyme::TT Views

SYNOPSIS

Top

    script/create.pl view TT Enzyme::TT







DESCRIPTION

Top

Helper for Enzyme::TT Views.

METHODS

Top

mk_compclass

cp_local_file($helper, $file_source_base, $subdir_source, $file_source_name, [$file_target_name = $file_source_name])

Copy the file at basename($file_source_base)/$subdir_source/$file_source_name into the application dir/$file_target_name.

SEE ALSO

Top

Catalyst::View::TT::ControllerLocal

AUTHOR

Top

Johan Lindstrom, johanl ÄT cpan.org

LICENSE

Top

This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.

NAME

Top

[% class %] - Catalyst Catalyst::Enzyme::CRUD::View TT View

SYNOPSIS

Top

See [% app %]

DESCRIPTION

Top

Catalyst TT View with Catalyst::View::TT::ControllerLocal and Catalyst::Enzyme::CRUD::View CRUD support.

AUTHOR

Top

[% author %]

LICENSE

Top

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


Catalyst-Enzyme documentation Contained in the Catalyst-Enzyme distribution.
package Catalyst::Helper::View::Enzyme::TT;

our $VERSION = '0.10';


use strict;
use Data::Dumper;
use File::Basename;
use File::Path;
use Path::Class;
use File::Slurp;



sub mk_compclass {
    my ( $self, $helper ) = @_;
    my $file = $helper->{file};
    $helper->render_file( 'compclass', $file );

    for my $template (
        qw/
           add.tt
           edit.tt
           footer.tt
           form_macros.tt
           header.tt
           list.tt
           list_macros.tt
           pager.tt
           pager_macros.tt
           view.tt
           view_macros.tt
           delete.tt
           /) {
        
        $self->cp_local_file($helper, __FILE__, "TT", "root/base/$template");
    }
    
    $self->cp_local_file($helper, __FILE__, "TT", "root/static/css/enzyme.css", "root/static/css/" . lc("$helper->{app}.css"));
}



sub cp_local_file {
    my ($self, $helper, $file_source_base, $subdir_source, $file_source_name, $file_target_name) = @_;
    $file_target_name ||= $file_source_name;

    my $dir_source = dir( dirname($file_source_base), $subdir_source );
    my $file_source = file($dir_source, $file_source_name);
    my $text_source = read_file("$file_source");

    my $file_target = file($helper->{'base'}, $file_target_name);

    mkpath(dirname($file_target));
    $helper->mk_file($file_target, $text_source);
}




1;

__DATA__

__compclass__
package [% class %];

use strict;
use base qw/ Catalyst::View::TT::ControllerLocal Catalyst::Enzyme::CRUD::View /;

1;