Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renderer-TT and Controller-CRUD have separate github projects now

  • Loading branch information...
commit 079bcd75ea52bfc8c629d3eda929e2e607ad25e7 1 parent 20f3e7c
Zbigniew Lukasiak authored
Showing with 0 additions and 1,107 deletions.
  1. +0 −7 extensions/WebNano-Controller-CRUD/app.psgi
  2. +0 −11 extensions/WebNano-Controller-CRUD/dist.ini
  3. +0 −151 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD.pm
  4. +0 −10 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/delete.tt
  5. +0 −6 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/edit.tt
  6. +0 −26 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/list.tt
  7. +0 −18 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/record.tt
  8. +0 −52 extensions/WebNano-Controller-CRUD/t/crud_base_controller.t
  9. +0 −10 extensions/WebNano-Controller-CRUD/t/data/app.conf
  10. BIN  extensions/WebNano-Controller-CRUD/t/data/dvdzbr.db
  11. +0 −10 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/delete.tt
  12. +0 −7 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/edit.tt
  13. +0 −28 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/list.tt
  14. +0 −71 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/record.tt
  15. +0 −40 extensions/WebNano-Controller-CRUD/t/lib/MyApp.pm
  16. +0 −17 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller.pm
  17. +0 −14 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller/DvdWithBaseCRUD.pm
  18. +0 −42 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller/Form.pm
  19. +0 −14 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller/OwnTemplates.pm
  20. +0 −16 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema.pm
  21. +0 −90 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Dvd.pm
  22. +0 −38 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Dvdtag.pm
  23. +0 −42 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Role.pm
  24. +0 −42 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Tag.pm
  25. +0 −52 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/UnicodeExamples.pm
  26. +0 −66 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/User.pm
  27. +0 −38 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/UserRole.pm
  28. BIN  extensions/WebNano-Controller-CRUD/t/tmp/dvdzbr.db
  29. +0 −11 extensions/WebNano-Renderer-TT/dist.ini
  30. +0 −95 extensions/WebNano-Renderer-TT/lib/WebNano/Renderer/TT.pm
  31. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt1/include_global.tt
  32. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt1/some_template.tt
  33. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir1/template.tt
  34. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir2/some
  35. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir2/template.tt
  36. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir2/template1.tt
  37. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt2/second_root.tt
  38. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt2/some_template.tt
  39. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt2/subdir1/second_root.tt
  40. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt2/subdir2/second_root.tt
  41. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt2/subdir2/second_root1.tt
  42. +0 −1  extensions/WebNano-Renderer-TT/t/data/tt_globals/some_global.tt
  43. +0 −71 extensions/WebNano-Renderer-TT/t/tt_renderer.t
View
7 extensions/WebNano-Controller-CRUD/app.psgi
@@ -1,7 +0,0 @@
-use lib 't/lib';
-
-use MyApp;
-my $app = MyApp->new();
-$app->psgi_callback;
-
-
View
11 extensions/WebNano-Controller-CRUD/dist.ini
@@ -1,11 +0,0 @@
-name = WebNano-Controller-CRUD
-author = Zbigniew Lukasiak <zby@cpan.org>
-license = Perl_5
-copyright_holder = Zbigniew Lukasiak <zby@cpan.org>
-copyright_year = 2010
-
-[@Basic]
-[AutoVersion]
-[AutoPrereq]
-[TestRelease]
-
View
151 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD.pm
@@ -1,151 +0,0 @@
-package WebNano::Controller::CRUD;
-use Moose;
-use MooseX::NonMoose;
-use Class::MOP;
-use File::Spec::Functions 'catdir';
-
-extends 'WebNano::Controller';
-
-has form_class => ( is => 'ro', isa => 'Str', required => 1 );
-has rs_name => ( is => 'ro', isa => 'Str', lazy_build => 1, );
-sub _build_rs_name {
- my $self = shift;
- my $my_name = ref $self;
- $my_name =~ /::(\w+)$/;
- return $1;
-}
-
-has record_actions => (
- is => 'ro',
- isa => 'HashRef',
- default => sub { { view => 1, 'delete' => 1, edit => 1 } }
-);
-
-my $FULLPATH;
-BEGIN { use Cwd (); $FULLPATH = Cwd::abs_path(__FILE__) }
-
-sub template_search_path {
- my $self = shift;
- my $mydir = $FULLPATH;
- $mydir =~ s/.pm$//;
- return [ catdir( $mydir, 'templates' ) ];
-}
-
-sub columns {
- my $self = shift;
- my $source = $self->app->schema->source( $self->rs_name );
- return [ $source->columns ];
-}
-
-
-sub parse_path {
- my( $self, $path ) = @_;
- my $parsed;
- my $method_reg = join '|', keys %{ $self->record_actions };
- if( $path =~ s{^(\d+)/($method_reg|)($|/)}{} ){
- $parsed->{ids} = [ $1 ];
- $parsed->{method} = $2 || 'view';
- $parsed->{args} = [ split /\//, $path ];
- return $parsed;
- }
- return;
-}
-
-around 'local_dispatch' => sub {
- my( $orig, $self, $path, @args ) = @_;
- my $parsed = $self->parse_path( $path );
- if( $parsed ){
- my $rs = $self->app->schema->resultset( $self->rs_name );
- my $record = $rs->find( @{ $parsed->{ids} } );
- if( ! $record ) {
- my $res = $self->req->new_response(404);
- $res->content_type('text/plain');
- $res->body( 'No record with ids: ' . join ' ', @{ $parsed->{ids} } );
- return $res;
- }
- my $method = $parsed->{method};
- return $self->$method( $record, @{ $parsed->{args} }, @args );
- }
- return $self->$orig( $path, @args );
-};
-
-sub index_action { shift->list_action( @_ ) }
-
-sub list_action {
- my( $self ) = @_;
- my $rs = $self->app->schema->resultset( $self->rs_name );
- return $self->render( template => 'list.tt', items => [ $rs->search ] );
-}
-
-sub create_action {
- my ( $self ) = @_;
- my $req = $self->req;
-
- my $form_class = $self->form_class;
- Class::MOP::load_class( $form_class );
- my $item = $self->app->schema->resultset( $self->rs_name )->new_result( {} );
- my $form = $form_class->new(
- params => $req->parameters->as_hashref,
- schema => $self->app->schema,
- item => $item,
- );
- if( $req->method eq 'POST' && $form->process() ){
- my $record = $form->item;
- my $res = $req->new_response();
- $res->redirect( $self->self_url . $record->id . '/view' );
- return $res;
- }
- $form->field( 'submit' )->value( 'Create' );
- return $self->render( template => 'edit.tt', form => $form->render );
-}
-
-sub view {
- my ( $self, $record ) = @_;
-
- return $self->render( template => 'record.tt', record => $record );
-}
-
-sub delete {
- my ( $self, $record ) = @_;
- if( $self->req->method eq 'GET' ){
- return $self->render( template => 'delete.tt', record => $record );
- }
- else{
- $record->delete;
- my $res = $self->req->new_response();
- $res->redirect( $self->self_url );
- return $res;
- }
-}
-
-sub edit {
- my ( $self, $record ) = @_;
- my $req = $self->req;
- my $form_class = $self->form_class;
- Class::MOP::load_class( $form_class );
- my $form = $form_class->new(
- item => $record,
- params => $req->parameters->as_hashref,
- );
- if( $req->method eq 'POST' && $form->process() ){
- my $res = $req->new_response();
- $res->redirect( $self->self_url . $record->id . '/view' );
- return $res;
- }
- $form->field( 'submit' )->value( 'Update' );
- return $self->render( template => 'edit.tt', form => $form->render );
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-WebNano::Controller::CRUD - A base controller implementing CRUD operations
-
-=head1 SYNOPSIS
-
-use base 'WebNano::Controller::CRUD';
-
-
View
10 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/delete.tt
@@ -1,10 +0,0 @@
-<html>
-<body>
-<form method="post">
-<fieldset class="widget_fieldset">
-<input class="submit" id="widget_ok" name="ok" type="submit" value="Delete ?" />
-</fieldset>
-</form>
-</body>
-</html>
-
View
6 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/edit.tt
@@ -1,6 +0,0 @@
-<html>
-<body>
-[% form %]
-</body>
-</html>
-
View
26 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/list.tt
@@ -1,26 +0,0 @@
-<html>
-<body>
-<table>
-<tr>
-[% FOREACH col IN c.columns %]
-<th>[% col %]</td>
-[% END %]
-<td></td>
-<td></td>
-<td></td>
-</tr>
-[% FOREACH record IN items %]
-<tr>
-[% FOREACH col IN c.columns %]
-<td>
-[% record.$col %]
-</td>
-[% END %]
-<td><a href="[% c.self_url %][% record.id %]/view">View</a></td>
-<td><a href="[% c.self_url %][% record.id %]/edit">Edit</a></td>
-<td><a href="[% c.self_url %][% record.id %]/delete">Delete</a></td>
-</tr>
-[% END %]
-</body>
-</html>
-
View
18 extensions/WebNano-Controller-CRUD/lib/WebNano/Controller/CRUD/templates/record.tt
@@ -1,18 +0,0 @@
-<html>
-<body>
-Fields.
-<table>
-[% FOREACH col IN c.columns %]
-<tr>
-<td>
-<strong>[% col %]</strong>
-</td>
-<td>
-[% record.$col %]
-</td>
-</tr>
-[% END %]
-</table>
-</body>
-</html>
-
View
52 extensions/WebNano-Controller-CRUD/t/crud_base_controller.t
@@ -1,52 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use Plack::Test;
-use HTTP::Request::Common;
-use lib 't/lib';
-use lib 'extensions/lib';
-use MyApp;
-use File::Copy;
-
-for my $controller( qw/DvdWithBaseCRUD OwnTemplates/ ){
-
- copy('t/data/dvdzbr.db','t/tmp/dvdzbr.db') or die "Copy failed: $!";
-
- test_psgi(
- app => MyApp->new()->psgi_callback,
- client => sub {
- my $cb = shift;
- my $res;
- $res = $cb->(GET "/$controller/");
- like( $res->content, qr/Jurassic Park II/ );
- $res = $cb->(POST "/$controller/5/edit", [ name => 'Not Jurassic Park' ] );
- ok( $res->is_redirect, 'Redirect after POST' );
- $res = $cb->(GET $res->header('Location'));
- $res = $cb->(GET "/$controller/create" );
- like( $res->content, qr/alter_date.year/ );
- $res = $cb->(POST "/$controller/create", [ name => 'A new dvd', owner => 1 ] );
- ok( $res->is_redirect, 'Redirect after POST' );
- $res = $cb->(GET $res->header('Location'));
- like( $res->content, qr/A new dvd/ );
- $res = $cb->(GET "/$controller/view/5");
- is( $res->code, 404 , '404 for view with no record' );
- $res = $cb->(GET "/$controller/555/view");
- is( $res->code, 404 , '404 for view with no record' );
- }
- );
-}
-
-test_psgi(
- app => MyApp->new()->psgi_callback,
- client => sub {
- my $cb = shift;
- my $res;
- $res = $cb->(GET "/OwnTemplates/");
- like( $res->content, qr{This is t/data/templates/OwnTemplates/list.tt} );
- $res = $cb->(GET "/OwnTemplates/5/view");
- like( $res->content, qr{This is t/data/templates/OwnTemplates/record.tt} );
- }
-);
-
-done_testing();
View
10 extensions/WebNano-Controller-CRUD/t/data/app.conf
@@ -1,10 +0,0 @@
-<renderer>
-root = t/data/templates
-</renderer>
-<schema>
-dbi_dsn = dbi:SQLite:dbname=t/tmp/dvdzbr.db
-<dbi_params>
-sqlite_unicode = 1
-</dbi_params>
-</schema>
-
View
BIN  extensions/WebNano-Controller-CRUD/t/data/dvdzbr.db
Binary file not shown
View
10 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/delete.tt
@@ -1,10 +0,0 @@
-<html>
-<body>
-<form method="post">
-<fieldset class="widget_fieldset">
-<input class="submit" id="widget_ok" name="ok" type="submit" value="Delete ?" />
-</fieldset>
-</form>
-</body>
-</html>
-
View
7 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/edit.tt
@@ -1,7 +0,0 @@
-<html>
-<body>
-[% form %]
-This is t/data/templates/OwnTemplates/edit.tt
-</body>
-</html>
-
View
28 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/list.tt
@@ -1,28 +0,0 @@
-<html>
-<body>
-<table>
-<tr>
-<th>name</td>
-<th>creation_date</td>
-<td></td>
-<td></td>
-<td></td>
-</tr>
-[% FOREACH record IN items %]
-<tr>
-<td>
-[% record.name %]
-</td>
-<td>
-[% record.creation_date %]
-</td>
-<td><a href="[% c.self_url %][% record.id %]/view">View</a></td>
-<td><a href="[% c.self_url %][% record.id %]/edit">Edit</a></td>
-<td><a href="[% c.self_url %][% record.id %]/delete">Delete</a></td>
-</tr>
-[% END %]
-
-This is t/data/templates/OwnTemplates/list.tt
-</body>
-</html>
-
View
71 extensions/WebNano-Controller-CRUD/t/data/templates/OwnTemplates/record.tt
@@ -1,71 +0,0 @@
-<html>
-<body>
-<table>
-<tr>
-<td>
-<strong>id</strong>
-</td>
-<td>
-[% record.id %]
-</td>
-</tr>
-<tr>
-<td>
-<strong>name</strong>
-</td>
-<td>
-[% record.name %]
-</tr>
-<tr>
-<td>
-<strong>imdb_id</strong>
-</td>
-<td>
-[% record.imdb_id %]
-</td>
-</tr>
-<tr>
-<td>
-<strong>owner</strong>
-</td>
-<td>
-[% record.owner %]
-</td>
-</tr>
-<tr>
-<td>
-<strong>current_borrower</strong>
-</td>
-<td>
-[% record.current_borrower %]
-</td>
-</tr>
-<tr>
-<td>
-<strong>creation_date</strong>
-</td>
-<td>
-[% record.creation_date %]
-</td>
-</tr>
-<tr>
-<td>
-<strong>alter_date</strong>
-</td>
-<td>
-[% record.alter_date %]
-</td>
-</tr>
-<tr>
-<td>
-<strong>hour</strong>
-</td>
-<td>
-[% record.hour %]
-</td>
-</tr>
-</table>
-This is t/data/templates/OwnTemplates/record.tt
-</body>
-</html>
-
View
40 extensions/WebNano-Controller-CRUD/t/lib/MyApp.pm
@@ -1,40 +0,0 @@
-package MyApp;
-use Moose;
-use MooseX::NonMoose;
-extends 'WebNano';
-use Config::Any;
-use MyApp::DBSchema;
-use WebNano::Renderer::TT;
-
-has config => ( is => 'ro', isa => 'HashRef', lazy_build => 1 );
-
-sub _build_config {
- my( $self ) = @_;
- return $self->get_config( 't/data/app' );
-}
-
-has schema => ( is => 'ro', isa => 'DBIx::Class::Schema', lazy_build => 1 );
-
-sub _build_schema {
- my $self = shift;
- my $config = $self->config->{schema};
- return MyApp::DBSchema->connect( $config->{dbi_dsn}, $config->{user}, $config->{pass}, $config->{dbi_params} );
-}
-
-has renderer => ( is => 'ro', lazy_build => 1 );
-sub _build_renderer {
- my $self = shift;
- my $config = $self->config->{renderer};
- return WebNano::Renderer::TT->new( %$config );
-}
-
-sub get_config {
- my( $self, $conf_file ) = @_;
-
- my $cfg = Config::Any->load_stems({ stems => [ $conf_file ], use_ext => 1 });
- my @values = values %{$cfg->[0]};
- return $values[0];
-}
-
-1;
-
View
17 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller.pm
@@ -1,17 +0,0 @@
-package MyApp::Controller;
-
-use Moose;
-use MooseX::NonMoose;
-extends 'WebNano::Controller';
-
-sub index_action {
- my $self = shift;
- my $res = $self->req->new_response();
- $res->redirect( '/DvdWithBaseCRUD' );
- return $res;
-}
-
-
-
-1;
-
View
14 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller/DvdWithBaseCRUD.pm
@@ -1,14 +0,0 @@
-package MyApp::Controller::DvdWithBaseCRUD;
-use Moose;
-
-extends 'WebNano::Controller::CRUD';
-
-has '+form_class' => ( default => 'MyApp::Controller::Form' );
-sub _build_rs_name { 'Dvd' };
-
-sub index_action {
- my $self = shift;
- return $self->list_action;
-}
-
-1;
View
42 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller/Form.pm
@@ -1,42 +0,0 @@
-use strict;
-use warnings;
-
-package MyApp::Controller::Form;
-use HTML::FormHandler::Moose;
-extends 'HTML::FormHandler::Model::DBIC';
-with 'HTML::FormHandler::Render::Simple';
-
-use DateTime;
-
-
-has '+item_class' => ( default => 'Dvd' );
-
-has_field 'tags' => ( type => 'Select', multiple => 1 );
-has_field 'hour' => ( type => 'Text', );
-has_field 'alter_date' => (
- type => 'Compound',
- apply => [
- {
- transform => sub{ DateTime->new( $_[0] ) },
- message => "Not a valid DateTime",
- }
- ],
- );
-has_field 'alter_date.year'; has_field 'alter_date.month'; has_field 'alter_date.day';
-has_field 'creation_date' => (
- type => 'Compound',
- apply => [
- {
- transform => sub{ DateTime->new( $_[0] ) },
- message => "Not a valid DateTime",
- }
- ],
- );
-has_field 'creation_date.year'; has_field 'creation_date.month'; has_field 'creation_date.day';
-has_field 'imdb_id' => ( type => 'Text', );
-has_field 'name' => ( type => 'TextArea', );
-has_field 'owner' => ( type => 'Select', );
-has_field 'current_borrower' => ( type => 'Select', );
-has_field 'submit' => ( widget => 'submit' );
-
-1;
View
14 extensions/WebNano-Controller-CRUD/t/lib/MyApp/Controller/OwnTemplates.pm
@@ -1,14 +0,0 @@
-package MyApp::Controller::OwnTemplates;
-use Moose;
-
-extends 'WebNano::Controller::CRUD';
-
-has '+form_class' => ( default => 'MyApp::Controller::Form' );
-sub _build_rs_name { 'Dvd' };
-
-sub index_action {
- my $self = shift;
- return $self->list_action;
-}
-
-1;
View
16 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema.pm
@@ -1,16 +0,0 @@
-package MyApp::DBSchema;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class::Schema';
-
-__PACKAGE__->load_namespaces;
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JDPcONC7Pl2Z6lIiq+c0yg
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-1;
View
90 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Dvd.pm
@@ -1,90 +0,0 @@
-package MyApp::DBSchema::Result::Dvd;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("dvd");
-__PACKAGE__->add_columns(
- "id",
- {
- data_type => "INTEGER",
- default_value => undef,
- is_nullable => 0,
- size => undef,
- },
- "name",
- {
- data_type => "VARCHAR",
- default_value => "NULL",
- is_nullable => 1,
- size => 255,
- },
- "imdb_id",
- {
- data_type => "INTEGER",
- default_value => "NULL",
- is_nullable => 1,
- size => undef,
- },
- "owner",
- {
- data_type => "INTEGER",
- default_value => undef,
- is_nullable => 0,
- size => undef,
- },
- "current_borrower",
- {
- data_type => "INTEGER",
- default_value => "NULL",
- is_nullable => 1,
- size => undef,
- },
- "creation_date",
- {
- data_type => "date",
- default_value => "NULL",
- is_nullable => 1,
- size => undef,
- },
- "alter_date",
- {
- data_type => "datetime",
- default_value => "NULL",
- is_nullable => 1,
- size => undef,
- },
- "hour",
- {
- data_type => "time",
- default_value => "NULL",
- is_nullable => 1,
- size => undef,
- },
-);
-__PACKAGE__->set_primary_key("id");
-__PACKAGE__->belongs_to("owner", "MyApp::DBSchema::Result::User", { id => "owner" });
-__PACKAGE__->belongs_to(
- "current_borrower",
- "MyApp::DBSchema::Result::User",
- { id => "current_borrower" },
-);
-__PACKAGE__->has_many(
- "dvdtags",
- "MyApp::DBSchema::Result::Dvdtag",
- { "foreign.dvd" => "self.id" },
-);
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UoDXZVFJ2iiSBDyuryAqgA
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->name}, fallback => 1;
-__PACKAGE__->many_to_many('tags', 'dvdtags' => 'tag');
-
-1;
View
38 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Dvdtag.pm
@@ -1,38 +0,0 @@
-package MyApp::DBSchema::Result::Dvdtag;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("dvdtag");
-__PACKAGE__->add_columns(
- "dvd",
- {
- data_type => "INTEGER",
- default_value => "'0'",
- is_nullable => 0,
- size => undef,
- },
- "tag",
- {
- data_type => "INTEGER",
- default_value => "'0'",
- is_nullable => 0,
- size => undef,
- },
-);
-__PACKAGE__->set_primary_key("dvd", "tag");
-__PACKAGE__->belongs_to("dvd", "MyApp::DBSchema::Result::Dvd", { id => "dvd" });
-__PACKAGE__->belongs_to("tag", "MyApp::DBSchema::Result::Tag", { id => "tag" });
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8ORWqxYKxkfoxPBWSdb4vw
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->id}, fallback => 1;
-
-1;
View
42 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Role.pm
@@ -1,42 +0,0 @@
-package MyApp::DBSchema::Result::Role;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("role");
-__PACKAGE__->add_columns(
- "id",
- {
- data_type => "INTEGER",
- default_value => undef,
- is_nullable => 0,
- size => undef,
- },
- "role",
- {
- data_type => "VARCHAR",
- default_value => undef,
- is_nullable => 1,
- size => 255,
- },
-);
-__PACKAGE__->set_primary_key("id");
-__PACKAGE__->has_many(
- "user_roles",
- "MyApp::DBSchema::Result::UserRole",
- { "foreign.role" => "self.id" },
-);
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:n4CpALZfWr0NHspe33U1Fg
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->id}, fallback => 1;
-__PACKAGE__->many_to_many('users', 'user_roles' => 'user');
-
-1;
View
42 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/Tag.pm
@@ -1,42 +0,0 @@
-package MyApp::DBSchema::Result::Tag;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("tag");
-__PACKAGE__->add_columns(
- "id",
- {
- data_type => "INTEGER",
- default_value => undef,
- is_nullable => 0,
- size => undef,
- },
- "name",
- {
- data_type => "VARCHAR",
- default_value => "NULL",
- is_nullable => 1,
- size => 255,
- },
-);
-__PACKAGE__->set_primary_key("id");
-__PACKAGE__->has_many(
- "dvdtags",
- "MyApp::DBSchema::Result::Dvdtag",
- { "foreign.tag" => "self.id" },
-);
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TviEAnSqLOSe22N9CVjauQ
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->name}, fallback => 1;
-__PACKAGE__->many_to_many('dvds', 'dvdtags' => 'dvd');
-
-1;
View
52 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/UnicodeExamples.pm
@@ -1,52 +0,0 @@
-package MyApp::DBSchema::Result::UnicodeExamples;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("unicode_examples");
-__PACKAGE__->add_columns(
- "id",
- {
- data_type => "INTEGER",
- default_value => undef,
- is_nullable => 0,
- size => undef,
- },
- "iso_country_code",
- { data_type => "CHAR", default_value => undef, is_nullable => 1, size => 2 },
- "language_name",
- {
- data_type => "varchar",
- default_value => undef,
- is_nullable => 1,
- size => 255,
- },
- "main_unicode_set",
- {
- data_type => "varchar",
- default_value => undef,
- is_nullable => 1,
- size => 255,
- },
- "example_text",
- {
- data_type => "text",
- default_value => undef,
- is_nullable => 1,
- size => undef,
- },
-);
-__PACKAGE__->set_primary_key("id");
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ir2IaYyjcI4Kvrb0bZ9tIQ
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->language_name}, fallback => 1;
-
-1;
View
66 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/User.pm
@@ -1,66 +0,0 @@
-package MyApp::DBSchema::Result::User;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("user");
-__PACKAGE__->add_columns(
- "id",
- {
- data_type => "INTEGER",
- default_value => undef,
- is_nullable => 0,
- size => undef,
- },
- "username",
- {
- data_type => "VARCHAR",
- default_value => "NULL",
- is_nullable => 1,
- size => 255,
- },
- "password",
- {
- data_type => "VARCHAR",
- default_value => "NULL",
- is_nullable => 1,
- size => 255,
- },
- "name",
- {
- data_type => "VARCHAR",
- default_value => "NULL",
- is_nullable => 1,
- size => 255,
- },
-);
-__PACKAGE__->set_primary_key("id");
-__PACKAGE__->has_many(
- "dvd_owners",
- "MyApp::DBSchema::Result::Dvd",
- { "foreign.owner" => "self.id" },
-);
-__PACKAGE__->has_many(
- "dvd_current_borrowers",
- "MyApp::DBSchema::Result::Dvd",
- { "foreign.current_borrower" => "self.id" },
-);
-__PACKAGE__->has_many(
- "user_roles",
- "MyApp::DBSchema::Result::UserRole",
- { "foreign.user" => "self.id" },
-);
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ESCNnLy5mnVkTZJlB8IsKw
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->username}, fallback => 1;
-__PACKAGE__->many_to_many('roles', 'user_roles' => 'role');
-
-1;
View
38 extensions/WebNano-Controller-CRUD/t/lib/MyApp/DBSchema/Result/UserRole.pm
@@ -1,38 +0,0 @@
-package MyApp::DBSchema::Result::UserRole;
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class';
-
-__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
-__PACKAGE__->table("user_role");
-__PACKAGE__->add_columns(
- "user",
- {
- data_type => "INTEGER",
- default_value => "'0'",
- is_nullable => 0,
- size => undef,
- },
- "role",
- {
- data_type => "INTEGER",
- default_value => "'0'",
- is_nullable => 0,
- size => undef,
- },
-);
-__PACKAGE__->set_primary_key("user", "role");
-__PACKAGE__->belongs_to("user", "MyApp::DBSchema::Result::User", { id => "user" });
-__PACKAGE__->belongs_to("role", "MyApp::DBSchema::Result::Role", { id => "role" });
-
-
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-10-16 17:19:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I7p+Rv8oCe1opFxCXOVNdw
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-use overload '""' => sub {$_[0]->id}, fallback => 1;
-
-1;
View
BIN  extensions/WebNano-Controller-CRUD/t/tmp/dvdzbr.db
Binary file not shown
View
11 extensions/WebNano-Renderer-TT/dist.ini
@@ -1,11 +0,0 @@
-name = WebNano-Renderer-TT
-author = Zbigniew Lukasiak <zby@cpan.org>
-license = Perl_5
-copyright_holder = Zbigniew Lukasiak <zby@cpan.org>
-copyright_year = 2010
-
-[@Basic]
-[AutoVersion]
-[AutoPrereq]
-[TestRelease]
-
View
95 extensions/WebNano-Renderer-TT/lib/WebNano/Renderer/TT.pm
@@ -1,95 +0,0 @@
-package WebNano::Renderer::TT;
-use strict;
-use warnings;
-
-use Template;
-use Object::Tiny::RW qw/ root _tt global_path INCLUDE_PATH TEMPLATE_EXTENSION/;
-use File::Spec;
-
-sub new {
- my( $class, %args ) = @_;
- my $self = bless {
- global_path => [ _to_list( delete $args{INCLUDE_PATH} ) ],
- root => delete $args{root},
- TEMPLATE_EXTENSION => delete $args{TEMPLATE_EXTENSION},
- }, $class;
- # Use a weakend copy of self so we dont have loops preventing GC from working
- my $copy = $self;
- Scalar::Util::weaken($copy);
- $args{INCLUDE_PATH} = [ sub { $copy->INCLUDE_PATH } ];
- $self->_tt( Template->new( \%args ) );
- return $self;
-}
-
-
-sub _to_list {
- if( ref $_[0] ){
- return @{ $_[0] };
- }
- elsif( ! defined $_[0] ){
- return ();
- }
- else{
- return $_[0];
- }
-}
-
-sub render {
- my( $self, %params ) = @_;
- my $c = $params{c};
- my @input_path;
- if( $c ){
- my $path = ref $c;
- $path =~ s/.*::Controller(::)?//;
- $path =~ s{::}{/};
- @input_path = ( $path, @{ $c->template_search_path });
- }
- if( !@input_path ){
- @input_path = ( '' );
- }
- my @path = @{ $self->global_path };
- for my $root( _to_list( $self->root ) ){
- for my $sub_path( @input_path ){
- if( File::Spec->file_name_is_absolute( $sub_path ) ){
- push @path, $sub_path;
- }
- else{
- push @path, File::Spec->catdir( $root, $sub_path );
- }
- }
- }
- $self->INCLUDE_PATH( \@path );
- my $template = $params{template};
- if( !$template ){
- my @caller = caller(2);
- $template = $caller[3];
- $template =~ s/_action$//;
- $template =~ s/^.*:://;
- $template .= '.' . $self->TEMPLATE_EXTENSION if $self->TEMPLATE_EXTENSION;
- }
- my $tt = $self->_tt;
- my $output;
- if( ! $tt->process( $template, \%params, \$output ) ){
- warn "Current INCLUDE_PATH: @path\n";
- die $tt->error();
- }
- return $output;
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-WebNano::Renderer::TT - Template Tookit renderer for WebNano
-
-=head1 SYNOPSIS
-
- use WebNano::Renderer::TT;
- $renderer = WebNano::Renderer::TT->new( root => [ 't/data/tt1', 't/data/tt2' ] );
- $out = '';
- $renderer->render( template => 'template.tt', search_path => [ 'subdir1', 'subdir2' ], output => \$out );
-
-=head1 DESCRIPTION
-
View
1  extensions/WebNano-Renderer-TT/t/data/tt1/include_global.tt
@@ -1 +0,0 @@
-[% INCLUDE some_global.tt %]
View
1  extensions/WebNano-Renderer-TT/t/data/tt1/some_template.tt
@@ -1 +0,0 @@
-tt1/some_template.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir1/template.tt
@@ -1 +0,0 @@
-tt1/subdir1/template.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir2/some
@@ -1 +0,0 @@
-This is 'some' template in 't/data/tt1/subdir2'
View
1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir2/template.tt
@@ -1 +0,0 @@
-tt1/subdir2/template.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt1/subdir2/template1.tt
@@ -1 +0,0 @@
-tt1/subdir2/template1.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt2/second_root.tt
@@ -1 +0,0 @@
-tt2/second_root.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt2/some_template.tt
@@ -1 +0,0 @@
-tt2/some_template.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt2/subdir1/second_root.tt
@@ -1 +0,0 @@
-tt2/subdir1/second_root.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt2/subdir2/second_root.tt
@@ -1 +0,0 @@
-tt2/subdir2/second_root.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt2/subdir2/second_root1.tt
@@ -1 +0,0 @@
-tt2/subdir2/second_root1.tt
View
1  extensions/WebNano-Renderer-TT/t/data/tt_globals/some_global.tt
@@ -1 +0,0 @@
-t/data/tt_globals/some_global.tt
View
71 extensions/WebNano-Renderer-TT/t/tt_renderer.t
@@ -1,71 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use lib 't/lib';
-
-use lib 'extensions/lib';
-use WebNano::Renderer::TT;
-{
- package MyApp::Controller::subdir1;
- use base 'WebNano::Controller';
-
- sub template_search_path { [ 'subdir2' ] }
-}
-
-{
- package MyApp::Controller::subdir2;
- use base 'WebNano::Controller';
-
- sub some_action {
- my( $self, $renderer ) = @_;
- return $self->render( $renderer );
- }
-
- sub render {
- my( $self, $renderer ) = @_;
- return $renderer->render( c => $self );
- }
-}
-
-my $renderer = WebNano::Renderer::TT->new( root => [ 't/data/tt2' ] );
-
-my $out = $renderer->render( template => 'some_template.tt' );
-is( $out, "tt2/some_template.tt\n" );
-
-$renderer = WebNano::Renderer::TT->new( root => [ 't/data/tt1', 't/data/tt2' ] );
-$out = $renderer->render( template => 'some_template.tt' );
-is( $out, "tt1/some_template.tt\n" );
-$out = $renderer->render( template => 'second_root.tt' );
-is( $out, "tt2/second_root.tt\n" );
-
-my $c = MyApp::Controller::subdir1->new();
-$out = $renderer->render( c => $c, template => 'template.tt' );
-is( $out, "tt1/subdir1/template.tt\n" );
-$c = MyApp::Controller::subdir2->new();
-$out = $renderer->render( c => $c, template => 'template.tt' );
-is( $out, "tt1/subdir2/template.tt\n" );
-$c = MyApp::Controller::subdir1->new();
-$out = $renderer->render( c => $c, template => 'template1.tt' );
-is( $out, "tt1/subdir2/template1.tt\n" );
-
-$out = $renderer->render( c => $c, template => 'second_root.tt' );
-is( $out, "tt2/subdir1/second_root.tt\n" );
-$c = MyApp::Controller::subdir2->new();
-$out = $renderer->render( c => $c, template => 'second_root.tt' );
-is( $out, "tt2/subdir2/second_root.tt\n" );
-$c = MyApp::Controller::subdir1->new();
-$out = $renderer->render( c => $c, template => 'second_root1.tt' );
-is( $out, "tt2/subdir2/second_root1.tt\n" );
-
-$renderer = WebNano::Renderer::TT->new( root => [ 't/data/tt1', 't/data/tt2' ], INCLUDE_PATH => 't/data/tt_globals' );
-$out = $renderer->render( template => 'include_global.tt' );
-is( $out, "t/data/tt_globals/some_global.tt\n\n" );
-
-is(
- MyApp::Controller::subdir2->new()->some_action( $renderer ),
- "This is 'some' template in 't/data/tt1/subdir2'\n"
-);
-
-done_testing();
-
Please sign in to comment.
Something went wrong with that request. Please try again.