Peter Flanigan > CatalystX-Usul > CatalystX::Usul::TraitFor::Model::StashHelper



Annotate this POD



Open  0
View/Report Bugs
Module Version: v0.17.1   Source  

Name ^

CatalystX::Usul::TraitFor::Model::StashHelper - Convenience methods for stuffing the stash

Version ^

Describes v0.17.$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 ^


   $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


   $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


   $self->add_buttons( @button_labels );

Loop around "add_button"


   $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


   $self->add_chooser_grid_rows( $args_hash_ref );


   $self->add_chooser_grid_table( $args_hash_ref );


   $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


   $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"



Adds data for a horizontal rule to separate the footer from the rest of the content. Add data to asynchronously load the footer data


   $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


   $self->add_result( $content );

Adds the result of forwarding to an an action. This is the result div in the template


   $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


   $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


   $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


   $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


   $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


   $self->clear_buttons( \%args );

Clears button data from the stash. Calls "_clear_by_id" with an id of buttons



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"


   $self->clear_footer( \%args );

Clears all footer data. Called by "add_footer". Calls "_clear_by_id" with an id of footer


   $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}


   $self->clear_header( \%args );

Clears all header data. Called by "add_header". Calls "_clear_by_id" with an id of header


   $self->clear_header( \%args );

Clears all hidden data. Called by "add_hidden". Calls "_clear_by_id" with an id of hidden



Clears the stash of the main navigation and tools menu data. Calls "_clear_by_id" with an id of menus



Clears the stash of the quick links navigation data. Calls "_clear_by_id" with an id of quick_links


   $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



Clears the stash of the data used by the sidebar accordion widget


   $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


   $self->form_wrapper( \%args );

Stashes the data used by HTML::FormWidgets to throw form around a group of fields


   $column_class = $model_obj->get_para_col_class( $n_columns );

Converts an integer number into a string representation


   $self->group_field( \%args );

Stashes the data used by HTML::FormWidgets to throw a fieldset around a group of fields


   $hits_object = $self->search_for( \%args );

Placeholder returns an instance of Class::Null. Should have been implemented in the interface model subclass


   $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"


   $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


   $self->stash_meta( $content, $id, $clear );

Adds some meta data to the response for an Ajax call


   $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


   $bool = $model_obj->update_group_membership( \%args );

Adds/removes lists of attributes from groups

Private Methods ^


   $self->_clear_by_id( $stack_id, $args );

Clears the specified stack of any items that have been added to it



Adds a horizontal rule to separate the footer. Called by "add_footer"

Configuration and Environment ^


Diagnostics ^


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>

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

syntax highlighting: