Name
CatalystX::Usul::TraitFor::Model::StashHelper - Convenience methods for stuffing the stash
Version
Describes v0.16.$Rev: 1 $
Synopsis
package CatalystX::Usul::Model;
use CatalystX::Usul::Moose;
extends q(Catalyst::Model);
with q(CatalystX::Usul::TraitFor::Model::StashHelper);
Description
Many convenience methods for stuffing/resetting the stash. The form widget definitions will be replaced later by the form building method which is called from the HTML view
Subroutines/Methods
add_append
$self->add_append( $content );
Stuff some content into the stash so that it will appear in the append
div in the template. The content is a hash ref which will be interpreted as a widget definition by the form builder which is invoked by the HTML view. Multiple calls push the content onto a stack which is rendered in the order in which items were added
add_button
$self->add_button( $args_hash_ref );
Add a button definition to the stash. The template will render these as image buttons on the button
div
add_buttons
$self->add_buttons( @button_labels );
Loop around "add_button"
add_chooser
$self->add_chooser( $args_hash_ref );
Generates the data for the popup chooser window which allows a data value to be selected from a list produced by some query. It is intended as a replacement for a popup menu widget where the list of values would be prohibitively long
add_chooser_grid_rows
$self->add_chooser_grid_rows( $args_hash_ref );
add_chooser_grid_table
$self->add_chooser_grid_table( $args_hash_ref );
add_error
$self->add_error( $error );
Stringifies the passed error object, localises the text, logs it as an error and calls "add_result" to display it at the top of the sdata
div
add_field
$self->add_field( $content, $id, $clear, $stack_dirn );
Create a widget definition for a form field. Sets $content->{widget>
to true and calls "stash_content"
add_footer
$self->add_footer;
Adds data for a horizontal rule to separate the footer from the rest of the content. Add data to asynchronously load the footer data
add_hidden
$self->add_header( $name, $values );
Adds one or more hidden
fields to the form. The $values
argument can be either a scalar or an array ref
add_result
$self->add_result( $content );
Adds the result of forwarding to an an action. This is the result
div in the template
add_result_msg
$self->add_result_msg( $message, $args );
Localises the message text and calls "add_result". If $message
is an array ref then messages are localised and "add_result" called for each array ref in the list
add_search_hit
$self->add_search_hit( $hit, $link_num, $field );
Placeholder should have been implemented in the class that applies this role. It should add the link to the page of search results
add_search_links
$self->add_search_links( $page_info, $attrs );
Adds the sequence of links used in search page results; first page, previous page, list of pages around the current one, next page, and last page
add_sidebar_panel
$count = $self->add_sidebar_panel( \%args );
Stuffs the stash with the data necessary to create a panel in the accordion widget on the sidebar. Returns the number of the newly created panel
clear_append
$self->clear_append( \%args );
Clears the stash of the widget data used by the region appended to the main data store. Calls "_clear_by_id" with an id
of append
clear_buttons
$self->clear_buttons( \%args );
Clears button data from the stash. Calls "_clear_by_id" with an id
of buttons
clear_controls
$self->clear_controls;
Groups the methods that clear the stash of data not used in a minority of pages. Calls; "clear_footer", "clear_menus", "clear_quick_links", and "clear_sidebar"
clear_footer
$self->clear_footer( \%args );
Clears all footer data. Called by "add_footer". Calls "_clear_by_id" with an id
of footer
clear_form
$self->clear_form( \%args );
Initialises the sdata
stack contents. Called by /stash_content
on first use. Calls "_clear_by_id". The args hash may contain; force
which clears the stack even if it contains data, title
which is used to set $c->stash->{title}
and $c->stash->{header}->{title}
, and firstfld
which is used to set $c->stash->{firstfld}
clear_header
$self->clear_header( \%args );
Clears all header data. Called by "add_header". Calls "_clear_by_id" with an id
of header
clear_hidden
$self->clear_header( \%args );
Clears all hidden data. Called by "add_hidden". Calls "_clear_by_id" with an id
of hidden
clear_menus
$self->clear_menus;
Clears the stash of the main navigation and tools menu data. Calls "_clear_by_id" with an id
of menus
clear_quick_links
$self->clear_quick_links;
Clears the stash of the quick links navigation data. Calls "_clear_by_id" with an id
of quick_links
clear_result
$self->clear_result( \%args );
Clears the stash of messages from the output of actions. Calls "_clear_by_id" with an id
of result
. Stash the localised phrase for the legend on the fieldset
clear_sidebar
$self->clear_sidebar;
Clears the stash of the data used by the sidebar accordion widget
form
$self->form( @args );
Calls the form method to stuff the stash with the data for the requested form. Uses the $c->stash->{form}->{name}
value to construct the method name
form_wrapper
$self->form_wrapper( \%args );
Stashes the data used by HTML::FormWidgets to throw form
around a group of fields
get_para_col_class
$column_class = $model_obj->get_para_col_class( $n_columns );
Converts an integer number into a string representation
group_fields
$self->group_field( \%args );
Stashes the data used by HTML::FormWidgets to throw a fieldset
around a group of fields
search_for
$hits_object = $self->search_for( \%args );
Placeholder returns an instance of Class::Null. Should have been implemented in the interface model subclass
search_page
$self->search_page( \%args );
Create a results page containing the previous and next links from Data::Pageset and the list links from calling "search_for"
stash_content
$self->stash_content( $content, $id, $clear, $stack_dirn );
Pushes the content (usually a widget definition) onto the specified stack. Defaults $id
to sdata
(the stash key of the content stack) and $clear
to "clear_form". The clear method is called to instantiate the stack on first use. A unique id is added to the stack item and a count of the number of stack items is incremented. The optional stack direction if true unshifts the item onto the stack as opposed to the default which pushes the item onto the stack
stash_meta
$self->stash_meta( $content, $id, $clear );
Adds some meta data to the response for an Ajax call
stash_para_col_class
$column_class = $model_obj->stash_para_col_class( $key, $n_columns );
Calls and returns the value from "get_para_col_class". Also stashes the value in the $key
attribute
update_group_membership
$bool = $model_obj->update_group_membership( \%args );
Adds/removes lists of attributes from groups
Private Methods
_clear_by_id
$self->_clear_by_id( $stack_id, $args );
Clears the specified stack of any items that have been added to it
_hash_for_footer_line
$self->_hash_for_footer_line;
Adds a horizontal rule to separate the footer. Called by "add_footer"
Configuration and Environment
None
Diagnostics
None
Dependencies
Incompatibilities
There are no known incompatibilities in this module.
Bugs and Limitations
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Author
Peter Flanigan, <Support at RoxSoft.co.uk>
License and Copyright
Copyright (c) 2014 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE