Skip to content

Commit

Permalink
fixed small partial rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 19, 2012
1 parent f519f62 commit d9f4e27
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -3,6 +3,7 @@ This file documents the revision history for Perl extension Mojolicious.
2.46 2012-01-19 00:00:00
- Improved documentation.
- Fixed small parser bug in Mojo::Message::Response.
- Fixed small partial rendering bug.

2.45 2012-01-18 00:00:00
- Removed T-Shirt link.
Expand Down
9 changes: 3 additions & 6 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -228,7 +228,7 @@ sub render {
# Render
my ($output, $type) = $self->app->renderer->render($self, $args);
return unless defined $output;
return $output if $args->{partial};
return Mojo::ByteStream->new($output) if $args->{partial};

# Prepare response
my $res = $self->res;
Expand Down Expand Up @@ -346,12 +346,9 @@ sub render_not_found {
sub render_partial {
my $self = shift;
my $template = @_ % 2 ? shift : undef;
my $args = {@_};

my $args = {@_, partial => 1};
$args->{template} = $template if defined $template;
$args->{partial} = 1;

return Mojo::ByteStream->new($self->render($args));
return $self->render($args);
}

sub render_static {
Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/layouted_lite_app.t
Expand Up @@ -333,7 +333,7 @@ localized2 <%= content %>
@@ outerlayout.html.ep
Hello
<%= include 'outermenu' %>
<%= $self->render('outermenu', partial => 1) %>
@@ outermenu.html.ep
% stash test => 'there';
Expand Down

0 comments on commit d9f4e27

Please sign in to comment.