Rose::DBx::Garden::Catalyst::Controller - base Controller class


Rose-DBx-Garden-Catalyst documentation Contained in the Rose-DBx-Garden-Catalyst distribution.

Index


Code Index:

NAME

Top

Rose::DBx::Garden::Catalyst::Controller - base Controller class

DESCRIPTION

Top

Rose::DBx::Garden::Catalyst::Controller is a subclass of CatalystX::CRUD::Controller::RHTMLO with some additional/overridden methods for working with YUI and JSON.

METHODS

Top

autocomplete_columns

Should return arrayref of fields to search when the autocomplete() URI method is requested.

The default is all the unique keys in model_name() that are made up of a single column.

AUTHOR

Top

Peter Karman, <karman at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-rose-dbx-garden-catalyst at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-DBx-Garden-Catalyst. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Rose::DBx::Garden::Catalyst

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Rose-DBx-Garden-Catalyst

* CPAN Ratings

http://cpanratings.perl.org/d/Rose-DBx-Garden-Catalyst

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-DBx-Garden-Catalyst

* Search CPAN

http://search.cpan.org/dist/Rose-DBx-Garden-Catalyst

ACKNOWLEDGEMENTS

Top

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

COPYRIGHT & LICENSE

Top


Rose-DBx-Garden-Catalyst documentation Contained in the Rose-DBx-Garden-Catalyst distribution.
package Rose::DBx::Garden::Catalyst::Controller;
use strict;
use warnings;
use base qw(
    CatalystX::CRUD::YUI::Controller
    CatalystX::CRUD::Controller::RHTMLO
);
use Carp;
use Data::Dump qw( dump );
use MRO::Compat;
use mro 'c3';

our $VERSION = '0.15';

sub _get_autocomplete_columns {
    my ( $self, $c ) = @_;
    my $model = $c->model( $self->model_name )->name;
    my @ukeys = $model->meta->unique_keys_column_names;
    my @cols;
    return [] unless @ukeys;
    for my $k (@ukeys) {
        if ( scalar(@$k) == 1
            && $model->meta->column( $k->[0] )->type =~ m/char/ )
        {
            push( @cols, $k->[0] );
        }
    }
    $self->autocomplete_columns( \@cols );
    return $self->autocomplete_columns;
}

1;

__END__