Peter Karman > CatalystX-CRUD-YUI > CatalystX::CRUD::YUI::Controller

Download:
CatalystX-CRUD-YUI-0.031.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.031   Source  

NAME ^

CatalystX::CRUD::YUI::Controller - base controller

SYNOPSIS ^

 package MyApp::Controller::Foo;
 use strict;
 
 # ISA order is important
 use base qw(
    CatalystX::CRUD::YUI::Controller
    CatalystX::CRUD::Controller::RHTMLO
 );
 
 __PACKAGE__->config(
    autocomplete_columns => [qw( foo bar )],
    autocomplete_method  => 'foo',
    hide_pk_columns      => 1,
    fuzzy_search         => 0,
    default_view         => 'YUI',
    fmt_to_view_map      => {
        'html' => 'YUI',
        'json' => 'YUI',
        'xls'  => 'Excel',
    },
 );
 
 1;

DESCRIPTION ^

This is a base controller class for use with CatalystX::CRUD::YUI applications. It implements URI and internal methods that the accompanying .tt and .js files rely upon.

NOTE: As of version 0.008 this class drops support for the YUI datatable feature and instead supports the ExtJS LiveGrid feature.

CONFIGURATION ^

See SYNOPSIS for config options specific to this class.

autocomplete_columns

See the autocomplete_columns() method. Value should be an array ref.

autocomplete_method

See the autocomplete_method() method. Value should be a method name.

hide_pk_columns

Used in the LiveGrid class. Boolean setting indicating whether the primary key column(s) should appear in the YUI LiveGrid listings or not. Default is true.

fuzzy_search

If true, the cxc-fuzzy param will be appended to all search queries via the .tt files. See CatalystX::CRUD::Model::Utils for more documentation about the cxc-fuzzy param.

default_view

The name of the View to use if cxc-fmt is not specified. This should be the name of a View that inherits from CatalystX::CRUD::YUI::View. The default is 'YUI'.

fmt_to_view_map

Hash ref of cxc-fmt types to View names. Used in end() to determine which View to set.

METHODS ^

Only new or overridden method are documented here.

new

Overrides base method just to call next::method and ensures config() gets merged correctly.

json_mime

Returns JSON MIME type. Default is 'application/json; charset=utf-8'.

default

Redirects to URI for 'count' in same namespace.

livegrid( context, arg )

Public URI method. Returns JSON for ExtJS LiveGrid feature.

livegrid_create_form( context )

Returns plain HTML form without wrapper for use with LiveGrid relationship manager.

livegrid_edit_form( context, oid )

Lke livegrid_create_form but returns form initialized for record represented by oid. Chained to fetch().

livegrid_related( oid, relationship_name )

Public URI method. Returns JSON for ExtJS LiveGrid feature.

do_related_search( context, relationship_name )

Sets up stash() to mimic the foreign controller represented by relationship_name.

remove

Overrides superclass method to set the content response to 'Ok' on success, or a generic error string on failure.

CAUTION: This URI is for ManyToMany only. Using it on OneToMany or ManyToOne rel_name values will delete the related row altogether.

add

Overrides superclass method to return the new record as JSON on success, or a generic error string on failure.

form_to_object

Overrides the base CRUD method to catch errors if the expected return format is JSON.

postcommit

Overrides base method to re-read object from db.

autocomplete_columns

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

Set this value in config(). Default is a no-op.

autocomplete_method

Which method should be called on each search result to create the response list.

Default is the first item in autocomplete_columns().

Set this value in config(). Default is a no-op.

autocomplete( context )

Public URI method. Supports the Rose::HTMLx::Form::Field::Autocomplete API.

end

Uses the RenderView ActionClass.

Prior to passing to view, sets current_view if it is not set, based on the cxc-fmt request parameter, defaulting to 'YUI'.

NOTE:This assumes you have a View class called YUI that inherits from CatalystX::CRUD::YUI::View.

AUTHOR ^

Peter Karman, <karman@cpan.org>

BUGS ^

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 ^

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

COPYRIGHT & LICENSE ^

Copyright 2008 by the Regents of the University of Minnesota.

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

syntax highlighting: