The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CatalystX::CRUD::YUI::View - base View class

SYNOPSIS

 # see catalyst::View::TT

DESCRIPTION

CatalystX::CRUD::YUI::View is a subclass of Catalyst::View::TT that extends the base class in a few minor ways. See METHODS for details.

CONFIGURATION

Configuration is the same as with Catalyst::View::TT. Read those docs.

The default config here is:

 __PACKAGE__->config(
    TEMPLATE_EXTENSION => '.tt',
    PRE_PROCESS        => 'crud/tt_config.tt',
    WRAPPER            => 'crud/wrapper.tt',
 );

METHODS

Only new or overridden method are documented here.

new

Overrides base new() method. Sets INCLUDE_PATH to the base CatalystX::CRUD::YUI::TT .tt files plus your local app root. This means you can override the default template behaviour by putting a .tt file with the same name in your root template dir.

For example, to customize your wrapper.tt file, just copy the default one from the CatalystX/CRUD/YUI/TT/crud/wrapper.tt in @INC and put it in root/crud/wrapper.tt. Likewise, you can set up a global config file by creating a root/crud/tt_config.tt file and putting your MACROs and other TT stuff in there.

template_vars

Overrides base method to add some other default variables.

  • The yui variable is a CatalystX::CRUD::YUI object.

  • The page variable is a hashref with members js and css. It is used by crud/page_head_maker.tt to ease the addition of per-request .js and .css files. Stuff the base file name into the array in each .tt file to get those files included in the page header.

    Example:

     [% page.css.push('foo') %]
     
     # html <head> section will contain:
     # <link type="stylesheet" href="[% static_url %]/css/foo.css" />
  • The static_url variable defaults to $c->uri_for('/static'). You can override that in $c->config() by setting a 'static_url' value to whatever base URL you wish. Ideal for serving your static content from different URL than your dynamic content.

process

Overrides base method to test if template is set in stash, and if it is, tests that it exists before calling next::method(). If it does not exist, will change the template value in stash to be crud/file.tt> in order to call the default crud template.

This path mangling allows you to avoid creating .tt files for all your actions unless you want to override the default template's behaviour.

render

Overrides base method to coerce output into UTF-8.

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.