diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-02-05 14:26:26 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-02-17 13:44:11 +0000 |
commit | d01b3c306f4b65ddfb0151cb890a7e3da96c4b97 (patch) | |
tree | 8ae0f73259afc427a5886ffabe5f98c6d12b81ed | |
parent | 2e9b93e1dc9c2e42d99b514e79689971830f7866 (diff) |
[TfL] Include borough name in report lists.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 13 | ||||
-rw-r--r-- | t/cobrand/tfl.t | 2 | ||||
-rw-r--r-- | templates/web/tfl/report/_item_heading.html | 3 | ||||
-rw-r--r-- | web/cobrands/tfl/base.scss | 4 |
4 files changed, 22 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index 5c08cb540..1fa0aabe0 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -22,6 +22,19 @@ sub council_url { return 'tfl'; } sub area_types { [ 'LBO' ] } sub is_council { 0 } +sub borough_for_report { + my ($self, $problem) = @_; + + # Get relevant area ID from report + my %areas = map { $_ => 1 } split ',', $problem->areas; + my ($council_match) = grep { $areas{$_} } @{ $self->council_area_id }; + return unless $council_match; + + # Look up area names if not already fetched + my $areas = $self->{c}->stash->{children} ||= $self->fetch_area_children; + return $areas->{$council_match}{name}; +} + sub abuse_reports_only { 1 } sub send_questionnaires { 0 } diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index e61c6d1bd..cdf3b1bab 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -551,11 +551,13 @@ subtest 'check correct base URL & title in AJAX pins' => sub { }; subtest 'check report age on /around' => sub { + $mech->log_in_ok($staffuser->email); my $report = FixMyStreet::DB->resultset("Problem")->find({ title => 'Test Report 1'}); $report->update({ state => 'confirmed' }); $mech->get_ok( '/around?lat=' . $report->latitude . '&lon=' . $report->longitude ); $mech->content_contains($report->title); + $mech->content_contains('item-list__item__borough">Bromley'); $report->update({ confirmed => \"current_timestamp-'7 weeks'::interval", diff --git a/templates/web/tfl/report/_item_heading.html b/templates/web/tfl/report/_item_heading.html index c9575f0fd..17ded1110 100644 --- a/templates/web/tfl/report/_item_heading.html +++ b/templates/web/tfl/report/_item_heading.html @@ -1,4 +1,7 @@ <h3 class="item-list__heading">[% problem.title | html %]</h3> +[% IF c.user.from_body || c.user.is_superuser %] + <small class="item-list__item__borough">[% c.cobrand.borough_for_report(problem) %]</small> +[% END %] [%~ IF c.user.has_permission_to('report_inspect', problem.bodies_str_ids) AND problem.get_extra_field_value('safety_critical') == 'yes' ~%] <small class="item-list__safety-critical">Safety Critical</small> [%~ END ~%] diff --git a/web/cobrands/tfl/base.scss b/web/cobrands/tfl/base.scss index 5e6f6426f..9c573f331 100644 --- a/web/cobrands/tfl/base.scss +++ b/web/cobrands/tfl/base.scss @@ -313,3 +313,7 @@ ol.big-numbers>li { text-transform: uppercase; } } + +.item-list__item__borough { + font-style: normal; +} |