aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2015-11-16 11:15:10 +0100
committerMarius Halden <marius.h@lden.org>2015-11-16 11:15:10 +0100
commit1339a64632c441e4d7858bd5946738c9840c624d (patch)
tree0b1393ca9af05d1af690fbf6c569c195f4136e4c /perllib/FixMyStreet/App/View/Web.pm
parent17cc40a8a2387669984ae4a36bb0d30d889d1a07 (diff)
parent4fb5331abd2fa4c89ebeb89bc92a245fadd0aa19 (diff)
Merge branch 'fiksgatami-dev' into fiksgatami-prod
Oppgrader prod til 1.7
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm20
1 files changed, 16 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index da549ece8..a92021f0c 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -11,7 +11,7 @@ use Utils;
__PACKAGE__->config(
TEMPLATE_EXTENSION => '.html',
- INCLUDE_PATH => [ #
+ INCLUDE_PATH => [
FixMyStreet->path_to( 'templates', 'web', 'base' ),
],
ENCODING => 'utf8',
@@ -38,17 +38,26 @@ TT View for FixMyStreet::App.
=cut
+# Override parent function so that errors are only logged once.
+sub _rendering_error {
+ my ($self, $c, $err) = @_;
+ my $error = qq/Couldn't render template "$err"/;
+ # $c->log->error($error);
+ $c->error($error);
+ return 0;
+}
+
=head2 loc
- [% loc('Some text to localize') %]
+ [% loc('Some text to localize', 'Optional comment for translator') %]
Passes the text to the localisation engine for translations.
=cut
sub loc {
- my ( $self, $c, @args ) = @_;
- return _(@args);
+ my ( $self, $c, $msgid ) = @_;
+ return _($msgid);
}
=head2 nget
@@ -133,6 +142,9 @@ sub escape_js {
'>' => 'u003e',
);
$text =~ s/([\\"'<>])/\\$lookup{$1}/g;
+
+ $text =~ s/(?:\r\n|\n|\r)/\\n/g; # replace newlines
+
return $text;
}