Skip to content
This repository has been archived by the owner on Jun 24, 2018. It is now read-only.

Commit

Permalink
Quick doc fixes before a push to CPAN
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Charles committed Mar 19, 2010
1 parent 181dc5a commit 32f754f
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions lib/Catalyst/View/HTML/Zoom.pm
Expand Up @@ -12,9 +12,8 @@ $VERSION = eval $VERSION;

extends 'Catalyst::View';

__PACKAGE__->config( stash_key => 'zoom', template_extension => undef );
__PACKAGE__->config( template_extension => undef );

has stash_key => ( is => 'ro', isa => NonEmptySimpleStr, required => 1 );
has template_extension => ( is => 'ro', isa => Undef|NonEmptySimpleStr, required => 1 );

method process ($c) {
Expand Down Expand Up @@ -55,40 +54,53 @@ Catalyst::View::HTML::Zoom - Catalyst view to HTML::Zoom
package MyApp::View::HTML;
use Moose;
extends 'Catalyst::View::HTML::Zoom';
#__PACKAGE__->config( stash_key => 'zoom' ); # This is the default
package MyApp::Controller::Wobble;
use Moose; BEGIN { extends 'Catalyst::Controller' }
sub dance : Local {
my ($self, $c) = @_;
$c->stash( shaking => 'hips' );
}
__PACKAGE__->meta->make_immutable;
package MyApp::View::HTML::Controller;
use Moose;
sub dance {
my ($self, $stash) = @_;
$_->select('#shake')->replace_content($stash->{shaking});
}
# Elsewhere in a controller method
#root/wobble/dance
<p>Shake those <span id="shake" />!</p>
sub foobar {
my ($self, $c) = @_;
# Merge pre-existing selectors
$c->stash->{zoom} = Catalyst::Utils::merge_hashes($c->stash->{zoom}||{},
'#name' => 'Dave'
);
# $c->stash->{template} = 'foobar'; # Can manually set the template, or
# it defaults to your action name.
}
/wobble/dance => "<p>Shake those hips!</p>";
=head1 METHODS
=head1 process
Renders the template specified in $c->stash->{template} or $c->action (the private name of the matched action).
Calls render to perform actual rendering. Output is stored in $c->response->body.
Renders the template specified in C<$c->stash->{template}> or C<$c->namespace/$c->action>
(the private name of the matched action). Calls render to perform actual rendering.
Output is stored in $c->response->body.
=head2 render($c, $template, \%args)
=head2 render($c, $template)
Renders the given template and returns output, or a Template::Exception object upon error.
=head1 WARNING: VOLATILE!
This is the first version of a Catalyst view to L<HTML::Zoom> - and we might have got it wrong. Please be
aware that this is still in early stages, and the API is not at all stable. You have been warned (but
encouraged to break it and submit bug reports and patches :).
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2010 Oliver Charles.
Copyright (c) 2009 Tomas Doran.
Original design by Thomas Doran, thanks t0m!
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
=cut
Expand Down

0 comments on commit 32f754f

Please sign in to comment.