Skip to content

Commit

Permalink
better descriptions for render methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 1, 2012
1 parent c27bae2 commit e6ac074
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,4 +1,7 @@

3.02 2012-07-02
- Improved documentation.

3.01 2012-07-01
- Improved CSS of built-in templates.
- Improved documentation. (diegok, sri)
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -34,7 +34,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Rainbow';
our $VERSION = '3.01';
our $VERSION = '3.02';

# "These old doomsday devices are dangerously unstable.
# I'll rest easier not knowing where they are."
Expand Down
22 changes: 11 additions & 11 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -713,11 +713,9 @@ C<url_for>.
my $success = $c->render('foo/index');
my $output = $c->render('foo/index', partial => 1);
This is a wrapper around L<Mojolicious::Renderer/"render"> exposing pretty
much all functionality provided by it. It will set a default template to use
based on the controller and action name or fall back to the route name. You
can call it with a hash or hash reference of options which can be preceded by
an optional template name.
This is a wrapper around L<Mojolicious::Renderer/"render">, if no template is
provided a default one based on controller and action or route name will be
generated. All additional values get merged into the C<stash>.
=head2 C<render_content>
Expand All @@ -735,7 +733,7 @@ C<extends> features.
$c->render_data($bytes, format => 'png');
Render the given content as raw bytes, similar to C<render_text> but data will
not be encoded.
not be encoded. All additional values get merged into the C<stash>.
# Longer version
$c->render(data => $bytes);
Expand All @@ -753,7 +751,8 @@ C<exception.$format.*> and set the response status code to C<500>.
$c->render_json({foo => 'bar'});
$c->render_json([1, 2, -3], status => 201);
Render a data structure as JSON.
Render a data structure as JSON. All additional values get merged into the
C<stash>.
# Longer version
$c->render(json => {foo => 'bar'});
Expand Down Expand Up @@ -803,9 +802,9 @@ C<public> directory or C<DATA> section of your application.
$c->render_text('Hello World', layout => 'green');
Render the given content as Perl characters, which will be encoded to bytes.
See C<render_data> for an alternative without encoding. Note that this does
not change the content type of the response, which is
C<text/html;charset=UTF-8> by default.
All additional values get merged into the C<stash>. See C<render_data> for an
alternative without encoding. Note that this does not change the content type
of the response, which is C<text/html;charset=UTF-8> by default.
# Longer version
$c->render(text => 'Hello World!');
Expand All @@ -818,7 +817,8 @@ C<text/html;charset=UTF-8> by default.
$c = $c->rendered;
$c = $c->rendered(302);
Finalize response and run C<after_dispatch> plugin hook.
Finalize response and run C<after_dispatch> plugin hook, defaults to using a
C<200> response code.
# Stream content directly from file
$c->res->content->asset(Mojo::Asset::File->new(path => '/etc/passwd'));
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Plugin/DefaultHelpers.pm
Expand Up @@ -203,7 +203,7 @@ Dump a Perl data structure using L<Data::Dumper>.
% extends 'blue';
% extends 'blue', title => 'Blue!';
Extend a template, all arguments get merged into the stash.
Extend a template. All additional values get merged into the C<stash>.
=head2 C<flash>
Expand All @@ -224,7 +224,8 @@ only available in the partial template.
% layout 'green';
% layout 'green', title => 'Green!';
Render this template with a layout, all arguments get merged into the stash.
Render this template with a layout. All additional values get merged into the
C<stash>.
=head2 C<memorize>
Expand Down Expand Up @@ -268,7 +269,7 @@ Alias for L<Mojolicious::Controller/"stash">.
% title 'Welcome!', foo => 'bar';
%= title
Page title, all arguments get merged into the stash.
Page title. All additional values get merged into the C<stash>.
=head2 C<url_for>
Expand Down

0 comments on commit e6ac074

Please sign in to comment.