Skip to content

Commit 008703f

Browse files
kareilamomijizukamori
authored andcommitted
another poll fix: entry object missing from template vars
1 parent 7513039 commit 008703f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cgi-bin/DW/Controller/Poll.pm

+11-10
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ sub index_handler {
6262

6363
my $u = $poll->journal;
6464

65-
my $vars = {
66-
remote => $remote,
67-
poll => $poll,
68-
pollid => $pollid,
69-
u => $u
70-
};
71-
7265
my $mode = "";
7366
$mode = $form->{'mode'}
7467
if ( defined $form->{'mode'} && $form->{'mode'} =~ /(enter|results|ans|clear)/ );
@@ -90,6 +83,17 @@ sub index_handler {
9083

9184
return error_ml('/poll/index.tt.error.cantview') unless ( $entry->visible_to($remote) );
9285

86+
# bundle variables to be passed to the template
87+
my $vars = {
88+
remote => $remote,
89+
u => $u,
90+
poll => $poll,
91+
pollid => $pollid,
92+
poll_form => $form,
93+
mode => $mode,
94+
entry => $entry,
95+
};
96+
9397
if ( defined $form->{'poll-submit'} && $r->did_post ) {
9498
my $error;
9599
my $error_code = LJ::Poll->process_submission( $form, \$error );
@@ -102,9 +106,6 @@ sub index_handler {
102106
}
103107
}
104108

105-
$vars->{poll} = $poll;
106-
$vars->{mode} = $mode;
107-
$vars->{poll_form} = $form;
108109
return DW::Template->render_template( 'poll/index.tt', $vars );
109110
}
110111

0 commit comments

Comments
 (0)