The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SweetPea::Application::Builder - HTML generator for SweetPea-Application.

SYNOPSIS

    ** EXPERIMENTAL - UNSTABLE (Thrown Together) **

    ... from inside SweetPea::Application or a Controller;
    my $profile = 'users'; # users table yaml profile
    my $form_object = $s->builder->form($profile);
    $s->builder->form($profile)->render;
    $s->builder->grid($profile)->render;

METHODS

new

    The new method instantiates a new SweetPea::Application::Builder object
    which is responsible for automatically generating form or grid elements,
    performing validation and . 
    
    $s->plug( 'builder', sub { return SweetPea::Application::Builder->new($s); });

form

    The form method generates html elements for use in web forms. This method
    is intended to reduce tedium when creating html forms.
    
    $s->builder->form('/table/users');
    
    Take 4 args.
    arg 1: required - yaml profile
    arg 2: optional - datasource resultset (arrayref of hashref)
    arg 3: optional - ordered list of fields (must also exist under the
            form > fields section in the yaml profile)
    arg 4: optional - element template
    
    ** NOTE **
    The returned html data is not wrapped in a html <form> tag and does not
    contain submit buttons for flexibility.

grid

    The grid method generates html table columns, rows and navigation for use
    in web pages. This method is intended to reduce tedium when creating html
    tables.
    
    $s->builder->grid('/table/users');
    
    Take 4 args.
    arg 1: required - yaml profile
    arg 2: optional - datasource resultset (arrayref of hashref)
    arg 3: optional - ordered list of fields (must also exist under the
            form > fields section in the yaml profile)
    arg 4: optional - element template
    
    ** NOTE **
    The returned html data is not wrapped in a html <table> tag for flexibility.

to

    The "to" method stores the returned html data in a specified section of the
    store (sweetpea stash) for use in another template or layout.

AUTHOR

Al Newkirk, <al.newkirk at awnstudio.com>