From: Moritz Bunkus Date: Wed, 6 Mar 2013 14:05:23 +0000 (+0100) Subject: ClientJS: render()-Funktion zum noch besseren Chaining X-Git-Tag: release-3.1.0beta1~558 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4d9d7d51900ba9fc5690e4ac11c18f524eba6969;p=kivitendo-erp.git ClientJS: render()-Funktion zum noch besseren Chaining --- diff --git a/SL/ClientJS.pm b/SL/ClientJS.pm index 47f8a225b..4a0080fc5 100644 --- a/SL/ClientJS.pm +++ b/SL/ClientJS.pm @@ -98,6 +98,11 @@ sub to_array { return $self->_actions; } +sub render { + my ($self, $controller) = @_; + return $controller->render(\$self->to_json, { type => 'json' }); +} + 1; __END__ @@ -198,6 +203,13 @@ are the function parameters. Returns the actions gathered so far as a JSON string ready to be sent to the client. +=item C + +Renders C<$self> via the controller. Useful for chaining. Equivalent +to the following: + + $controller->render(\$self->to_json, { type => 'json' }); + =back =head1 FUNCTIONS EVALUATED ON THE CLIENT SIDE