aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-08-15 14:03:40 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-08-18 09:43:42 +0100
commitd2c9d3f4dbdff822f90a4934d858dabec2c85e17 (patch)
tree229ecaae84b7b5659953faa30fe1b281a1ff45cf
parent31b8337e38b1b39db1660fb877bf1419cc6128f9 (diff)
[Zurich] Bring all reports in line with upstream.
Update the map/list if the map is zoomed/panned, and make sure the updated HTML list is returned.
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm1
-rw-r--r--t/Mock/MapItZurich.pm2
-rw-r--r--t/cobrand/zurich.t14
-rwxr-xr-xtemplates/web/zurich/reports/index.html18
4 files changed, 20 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 2b5777773..fbb0e94a1 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -36,6 +36,7 @@ sub index : Path : Args(0) {
if ( $c->cobrand->moniker eq 'zurich' ) {
$c->forward( 'stash_report_filter_status' );
$c->forward( 'load_and_group_problems' );
+ $c->stash->{body} = { id => 0 }; # So template can fetch the list
if ($c->get_param('ajax')) {
$c->detach('ajax', [ 'reports/_problem-list.html' ]);
diff --git a/t/Mock/MapItZurich.pm b/t/Mock/MapItZurich.pm
index 9195749f6..f7bcda31d 100644
--- a/t/Mock/MapItZurich.pm
+++ b/t/Mock/MapItZurich.pm
@@ -46,4 +46,6 @@ sub dispatch_request {
},
}
+LWP::Protocol::PSGI->register(t::Mock::MapItZurich->to_psgi_app, host => 'mapit.zurich');
+
__PACKAGE__->run_if_script;
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 64d754663..225fbfd41 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -703,7 +703,6 @@ subtest "only superuser can edit bodies" => sub {
};
subtest "only superuser can see 'Add body' form" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
$user = $mech->log_in_ok( 'dm1@example.org' );
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'zurich' ],
@@ -718,7 +717,6 @@ subtest "only superuser can see 'Add body' form" => sub {
};
subtest "phone number is mandatory" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
FixMyStreet::override_config {
MAPIT_TYPES => [ 'O08' ],
MAPIT_URL => 'http://mapit.zurich/',
@@ -735,7 +733,6 @@ subtest "phone number is mandatory" => sub {
};
subtest "phone number is not mandatory for reports from mobile apps" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
FixMyStreet::override_config {
MAPIT_TYPES => [ 'O08' ],
MAPIT_URL => 'http://mapit.zurich/',
@@ -762,7 +759,6 @@ subtest "phone number is not mandatory for reports from mobile apps" => sub {
};
subtest "problems can't be assigned to deleted bodies" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
$user = $mech->log_in_ok( 'dm1@example.org' );
$user->from_body( $zurich->id );
$user->update;
@@ -791,7 +787,6 @@ subtest "problems can't be assigned to deleted bodies" => sub {
};
subtest "photo must be supplied for categories that require it" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
FixMyStreet::App->model('DB::Contact')->find_or_create({
body => $division,
category => "Graffiti - photo required",
@@ -969,13 +964,20 @@ FixMyStreet::override_config {
MAPIT_URL => 'http://mapit.zurich/',
MAPIT_TYPES => [ 'ZZZ' ],
}, sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
subtest 'users at the top level can be edited' => sub {
$mech->log_in_ok( $superuser->email );
$mech->get_ok('/admin/user_edit/' . $superuser->id );
};
};
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ subtest 'A visit to /reports is okay' => sub {
+ $mech->get_ok('/reports');
+ };
+};
+
END {
ok $mech->host("www.fixmystreet.com"), "change host back";
done_testing();
diff --git a/templates/web/zurich/reports/index.html b/templates/web/zurich/reports/index.html
index f7383dfee..8bec64c86 100755
--- a/templates/web/zurich/reports/index.html
+++ b/templates/web/zurich/reports/index.html
@@ -13,17 +13,17 @@
<h1>[% loc('All Reports') %]</h1>
<section class="full-width">
- [% INCLUDE 'pagination.html', param = 'p' %]
+ <div class="js-pagination">
+ [% INCLUDE 'pagination.html', param = 'p' %]
+ </div>
- [% IF problems.0 %]
- <ul class="item-list item-list--reports">
- [% FOREACH problem IN problems.0 %]
- [% INCLUDE 'reports/_list-entry.html' %]
- [% END %]
- </ul>
- [% END %]
+ <div id="js-reports-list">
+ [% INCLUDE 'reports/_problem-list.html' %]
+ </div>
- [% INCLUDE 'pagination.html', param = 'p' %]
+ <div class="js-pagination">
+ [% INCLUDE 'pagination.html', param = 'p' %]
+ </div>
</section>
</div>