aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/general-example3
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm16
-rw-r--r--templates/web/default/report/_main.html2
3 files changed, 18 insertions, 3 deletions
diff --git a/conf/general-example b/conf/general-example
index 6401528a9..129cee386 100644
--- a/conf/general-example
+++ b/conf/general-example
@@ -75,4 +75,7 @@ define('OPTION_ALLOWED_COBRANDS', 'cobrand_one|cobrand_two');
// How many items are returned in the GeoRSS feeds by default
define('OPTION_RSS_LIMIT', '20');
+// Should problem reports link to the council summary pages?
+define('OPTION_AREA_LINKS_FROM_PROBLEMS', '0');
+
?>
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index f2f130390..366024c7c 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -364,8 +364,9 @@ sub meta_line {
return $meta;
}
+# TODO Some/much of this could be moved to the template
sub duration_string {
- my $problem = shift;
+ my ( $problem, $c ) = @_;
my $body;
if ($problem->external_body) {
$body = $problem->external_body;
@@ -373,7 +374,18 @@ sub duration_string {
(my $council = $problem->council) =~ s/\|.*//g;
my @councils = split( /,/, $council );
my $areas_info = mySociety::MaPit::call('areas', \@councils);
- $body = join(' and ', map { $areas_info->{$_}->{name} } @councils);
+ $body = join( _(' and '),
+ map {
+ my $name = $areas_info->{$_}->{name};
+ if (mySociety::Config::get('AREA_LINKS_FROM_PROBLEMS')) {
+ '<a href="'
+ . $c->uri_for( '/reports/' . $c->cobrand->short_name( $areas_info->{$_} ) )
+ . '">' . $name . '</a>';
+ } else {
+ $name;
+ }
+ } @councils
+ );
}
return sprintf(_('Sent to %s %s later'), $body,
Utils::prettify_duration($problem->whensent_local->epoch - $problem->confirmed_local->epoch, 'minute')
diff --git a/templates/web/default/report/_main.html b/templates/web/default/report/_main.html
index 0c0c74b16..8cc1efec2 100644
--- a/templates/web/default/report/_main.html
+++ b/templates/web/default/report/_main.html
@@ -3,7 +3,7 @@
<p><em>[% problem.meta_line(c) | html %]
[% IF problem.council %]
[% IF problem.whensent %]
- <small class="council_sent_info"><br>[% problem.duration_string %]</small>
+ <small class="council_sent_info"><br>[% problem.duration_string(c) %]</small>
[% END %]
[% ELSE %]
<br><small>[% loc('Not reported to council') %]</small>