aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r--perllib/FixMyStreet/App.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 21552a066..d39ae1415 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -402,6 +402,22 @@ sub finalize {
delete $c->stash->{cobrand};
}
+=head2 render_fragment
+
+If a page needs to render a template fragment internally (e.g. for an Ajax
+call), use this method.
+
+=cut
+
+sub render_fragment {
+ my ($c, $template, $vars) = @_;
+ $vars ||= {};
+ $vars->{additional_template_paths} = [ $c->cobrand->path_to_web_templates->stringify ]
+ unless $c->cobrand->is_default;
+ $c->view('Web')->render($c, $template, $vars);
+}
+
+
=head1 SEE ALSO
L<FixMyStreet::App::Controller::Root>, L<Catalyst>