aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-02-23 11:56:37 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-02-23 11:57:31 +0000
commita3b774254a987c767dae890ed076e685dff4c561 (patch)
tree5bf352d875ffcca2d251dc816f5e6326b21c93da /perllib/FixMyStreet/App.pm
parenta20baf15cabeaf50b6d9e5632e59cd44f18976bc (diff)
Factor out fragment rendering, as additional template paths needs to be passed.
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>