Catalyst-Plugin-CRUD

 view release on metacpan or  search on metacpan

lib/Catalyst/Helper/Model/CRUD.pm  view on Meta::CPAN

}

=head1 SEE ALSO

DBDesigner 4 -- http://fabforce.net/dbdesigner4/index.php

Catalyst::Helper::Model, Catalyst::Plugin::CRUD, XML::Simple

=head1 AUTHOR

Jun Shimizu, E<lt>bayside@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2006-2007 by Jun Shimizu

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.2 or,
at your option, any later version of Perl 5 you may have available.

=cut

1;

__DATA__

__schema_sql__
-- DROP TABLE [% table %];

-- [% comment %]
CREATE TABLE [% table %] (
[% columns %]
);

GRANT ALL ON [% table %] TO PUBLIC;
[% serials %]

__controller_class__
package [% app_name %]::Controller::[% class_name %];

use strict;
use warnings;
use base 'Catalyst::Controller';
use Class::Trigger;

sub default : Private {
    my ( $self, $c ) = @_;
    $c->forward('list');
}

sub create : Local {
    my ( $self, $c ) = @_;
    $c->create($self);
}

sub read : Local {
    my ( $self, $c ) = @_;
    $c->read($self);
}

sub update : Local {
    my ( $self, $c ) = @_;
    $c->update($self);
}

sub delete : Local {
    my ( $self, $c ) = @_;
    $c->delete($self);
}

sub list : Local {
    my ( $self, $c ) = @_;
    $c->list($self);
}

sub setting {
    my ( $self, $c ) = @_;
    my $hash = {
        'name'     => '[% path_name %]',
        'type'     => '[% base_name %]',
        'model'    => '[% base_name %]::[% model_name %]',
        'primary'  => '[% primary %]',
        'columns'  => [qw([% columns %])],
        'default'  => '/[% path_name %]/list',
        'template' => {
            'prefix' => 'template/[% path_name %]/',
            'suffix' => '.tt'
        },
    };
    return $hash;
}

1;

__header_html__
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>[% app_name %]</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- http://openjsan.org/doc/k/ko/komagata/Widget/Dialog/ -->
    <script type="text/javascript" src="/static/js/Widget/Dialog.js"></script>
    <!-- link rel="stylesheet" href="styles.css" / -->
    <style type="text/css">
    <!--
      #centre {
      border:1px solid #202020;
      border-bottom:0;
      border-top:0;
      color:#000;
      padding:1.5em;
      }

      #conteneur {
      background-color:#fafafa;
      margin:1em 5%;
      min-width:60em;
      position:absolute;
      width:90%;
      }



( run in 0.874 second using v1.01-cache-2.11-cpan-39bf76dae61 )