add "asset" property to AssetHelpers.

Simplifies the API and allows us to have getForm and getUrl to make
asset helpers easier to build.
This commit is contained in:
Doug Bell 2011-03-25 14:49:44 -05:00
parent df31c13e13
commit 698f40a6dd
23 changed files with 216 additions and 123 deletions

View file

@ -89,11 +89,11 @@ sub handler {
my $helperId = $session->form->get('helperId');
my $class = $asset->getHelpers->{ $helperId }->{ className };
WebGUI::Pluggable::load( $class );
my $helper = $class->new( id => $helperId, session => $session );
my $helper = $class->new( id => $helperId, session => $session, asset => $asset );
my $method = $session->form->get('method') || "view";
if ( $helper->can( "www_" . $method ) ) {
return $helper->can( "www_" . $method )->( $helper, $asset );
return $helper->can( "www_" . $method )->( $helper );
}
else {
$session->log->error( sprintf 'Invalid asset helper "%s" calling method "%s"', $helperId, $method );