CatalystX::CRUD::YUI - YUI for your CatalystX::CRUD view


CatalystX-CRUD-YUI documentation Contained in the CatalystX-CRUD-YUI distribution.

Index


Code Index:

NAME

Top

CatalystX::CRUD::YUI - YUI for your CatalystX::CRUD view

SYNOPSIS

Top

 package MyApp::Controller::Foo;
 use strict;
 use base qw(
    CatalystX::CRUD::YUI::Controller
    CatalystX::CRUD::Controller::RHTMLO
 );

 # config here -- see CatalystX::CRUD::Controller docs

 1;

DESCRIPTION

Top

CatalystX::CRUD::YUI is a crud application using the Yahoo User Interface and ExtJS toolkits, and CatalystX::CRUD components. It is derived largely from the Rose::DBx::Garden::Catalyst project but now with support for DBIx::Class via the CatalystX::CRUD::ModelAdapter::DBIC package.

The t/ test directly for this package contains two full Catalyst applications, one for RDBO and one for DBIC, both using the same basic db schema. Looking at those examples is a good way to start.

METHODS

Top

Only new or overridden method are documented here.

new( opts )

livegrid( opts )

Returns a CatalystX::CRUD::YUI::LiveGrid object ready for the livegrid_*.tt templates.

opts should consist of:

results

results may be either a CatalystX::CRUD::Results object or a CatalystX::CRUD::Object object.

controller

The Catalyst::Controller instance for the request.

form

The current Form object. The Form class should be Rose::HTMLx::Form::Related, a subclass thereof, or a class with a corresponding API.

rel_info

If results is a CatalystX::CRUD::Object object, then a rel_info should be passed indicating which relationship to pull data from.

field_names

Optional arrayref of field names to include. Defaults to form->meta->field_methods().

serializer

Returns new Serializer object of type serializer_class().

AUTHOR

Top

Peter Karman, <karman@cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-catalystx-crud-yui@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Top

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE

Top


CatalystX-CRUD-YUI documentation Contained in the CatalystX-CRUD-YUI distribution.
package CatalystX::CRUD::YUI;

use warnings;
use strict;
use Carp;
use CatalystX::CRUD::YUI::LiveGrid;
use CatalystX::CRUD::YUI::Serializer;
use base qw( Class::Accessor::Fast );
use MRO::Compat;
use mro "c3";
use Data::Dump qw( dump );

__PACKAGE__->mk_accessors(
    qw( serializer_class livegrid_class ));

our $VERSION = '0.025';

sub new {
    my $self = shift->next::method(@_);
    $self->{serializer_class} ||= 'CatalystX::CRUD::YUI::Serializer';
    $self->{livegrid_class}   ||= 'CatalystX::CRUD::YUI::LiveGrid';
    return $self;
}

sub _fix_args {
    my @arg = @_;
    if ( @arg == 1 ) {
        if ( ref( $arg[0] ) eq 'ARRAY' ) {
            @arg = @{ $arg[0] };
        }
        elsif ( ref( $arg[0] ) eq 'HASH' ) {
            @arg = %{ $arg[0] };
        }
    }
    return @arg;
}

sub livegrid {
    my $self = shift;
    return $self->livegrid_class->new( _fix_args(@_), yui => $self );
}

sub serializer {
    my $self = shift;
    return $self->serializer_class->new( _fix_args(@_), yui => $self );
}

1;

__END__