aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--perllib/FixMyStreet/Cobrand/Buckinghamshire.pm25
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm2
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm2
-rw-r--r--t/Mock/MapIt.pm1
-rw-r--r--t/cobrand/bucks.t51
-rw-r--r--templates/web/base/tokens/confirm_problem.html6
-rw-r--r--web/cobrands/bathnes/assets.js2
-rw-r--r--web/cobrands/bristol/assets.js6
-rw-r--r--web/cobrands/bromley/assets.js2
-rw-r--r--web/cobrands/buckinghamshire/assets.js8
-rw-r--r--web/cobrands/fixmystreet/assets.js7
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js4
-rw-r--r--web/cobrands/sass/_base.scss6
-rw-r--r--web/js/map-OpenLayers.js4
15 files changed, 100 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f746f1af3..ade890b0d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- Only display last 6 months of reports on around page by default #2098
- Always show all reports by default on /my.
- Much less reliance on input placeholders, for better accessibility #2180
+ - “Report another problem here” button on report confirmation page #2198
- Button in nav bar now makes it easier to report again in the same location #2195
- Admin improvements:
- Mandatory defect type selection if defect raised.
@@ -30,6 +31,7 @@
- Hide password help field along with other similar. #2185
- Allow questionnaire link to be revisited in quick succession. #2123
- Update Google Maps directions link.
+ - Fix inspector pin dragging. #2073.
- Open311 improvements:
- CLOSED status maps to 'closed' state if extended statuses are enabled.
- Don't generate template comment text on move between fixed states.
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
index c910756cc..f02ee9e51 100644
--- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
@@ -43,6 +43,8 @@ sub disambiguate_location {
};
}
+sub on_map_default_status { 'open' }
+
sub pin_colour {
my ( $self, $p, $context ) = @_;
return 'grey' if $p->state eq 'not responsible';
@@ -89,21 +91,18 @@ sub open311_config {
$row->set_extra_fields(@$extra);
}
-# This provides a similar functionality to open311_config, but for email.
-sub munge_sendreport_params {
- my ($self, $row, $vars, $hdrs) = @_;
+sub open311_post_send {
+ my ($self, $row, $h) = @_;
+
+ # Check Open311 was successful
+ return unless $row->external_id;
+ # For Flytipping, send an email also
return unless $row->category eq 'Flytipping';
- # Reports made via FMS.com or the app probably won't have a site code
- # value because we don't display the adopted highways layer on those
- # frontends. Instead we'll look up the closest asset from the WFS
- # service at the point we're sending the report by email.
- my $site_code = $row->get_extra_field_value('site_code') || $self->lookup_site_code($row, 5);
- if ($site_code) {
- my $e = join('', 'crmbusinesssupport', '@', $self->admin_user_domain);
- push @{$hdrs->{To}}, [ $e, 'TfB' ];
- }
+ my $e = join('', 'illegaldumpingcosts', '@', $self->admin_user_domain);
+ my $sender = FixMyStreet::SendReport::Email->new( to => [ [ $e, 'TfB' ] ] );
+ $sender->send($row, $h);
}
sub map_type { 'Buckinghamshire' }
@@ -334,7 +333,7 @@ sub categories_restriction {
my ($self, $rs) = @_;
# Buckinghamshire is a two-tier council, but only want to display
# county-level categories on their cobrand.
- return $rs->search( { 'body_areas.area_id' => 2217 }, { join => { body => 'body_areas' } });
+ return $rs->search( [ { 'body_areas.area_id' => 2217 }, { category => 'Flytipping' } ], { join => { body => 'body_areas' } });
}
sub lookup_site_code {
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index 079f8ba68..4307694a1 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -57,7 +57,7 @@ sub send {
my $self = shift;
my ( $row, $h ) = @_;
- my $recips = $self->build_recipient_list( $row, $h );
+ my $recips = @{$self->to} ? 1 : $self->build_recipient_list( $row, $h );
# on a staging server send emails to ourselves rather than the bodies
if (FixMyStreet->staging_flag('send_reports', 0) && !FixMyStreet->test_mode) {
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index 84aa851ed..ed71d153b 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -94,6 +94,8 @@ sub send {
$self->error( "Failed to send over Open311\n" ) unless $self->error;
$self->error( $self->error . "\n" . $open311->error );
}
+
+ $cobrand->call_hook(open311_post_send => $row, $h);
}
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 8cb5d777f..eb54ad5d4 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -26,6 +26,7 @@ my @PLACES = (
[ '?', 53.387402, -2.943997, 2527, 'Liverpool City Council', 'MTD' ],
[ 'EH1 1BB', 55.952055, -3.189579, 2651, 'Edinburgh City Council', 'UTA', 20728, 'City Centre', 'UTE' ],
[ 'BS10 5EE', 51.494885, -2.602237, 2561, 'Bristol City Council', 'UTA', 148646, 'Bedminster', 'UTW' ],
+ [ 'SL9 0NX', 51.615559, -0.556903, 2217, 'Buckinghamshire County Council', 'CTY', 2257, 'Chiltern District Council', 'DIS' ],
[ 'SW1A 1AA', 51.501009, -0.141588, 2504, 'Westminster City Council', 'LBO' ],
[ 'GL50 2PR', 51.896268, -2.093063, 2226, 'Gloucestershire County Council', 'CTY', 2326, 'Cheltenham Borough Council', 'DIS', 4544, 'Lansdown', 'DIW', 143641, 'Lansdown and Park', 'CED' ],
[ '?', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],
diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t
index 882de8179..17e850196 100644
--- a/t/cobrand/bucks.t
+++ b/t/cobrand/bucks.t
@@ -4,8 +4,15 @@ use FixMyStreet::Script::Reports;
my $mech = FixMyStreet::TestMech->new;
-my $body = $mech->create_body_ok(2217, 'Buckinghamshire');
-$mech->create_contact_ok(body_id => $body->id, category => 'Flytipping', email => "flytipping\@example.org");
+my $body = $mech->create_body_ok(2217, 'Buckinghamshire', {
+ send_method => 'Open311', api_key => 'key', endpoint => 'endpoint', jurisdiction => 'fms' });
+
+$mech->create_contact_ok(body_id => $body->id, category => 'Flytipping', email => "FLY");
+$mech->create_contact_ok(body_id => $body->id, category => 'Potholes', email => "POT");
+
+my $district = $mech->create_body_ok(2257, 'Chiltern');
+$mech->create_contact_ok(body_id => $district->id, category => 'Flytipping', email => "flytipping\@chiltern");
+$mech->create_contact_ok(body_id => $district->id, category => 'Graffiti', email => "graffiti\@chiltern");
my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Buckinghamshire');
$cobrand->mock('lookup_site_code', sub {
@@ -16,6 +23,7 @@ $cobrand->mock('lookup_site_code', sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'buckinghamshire', 'fixmystreet' ],
MAPIT_URL => 'http://mapit.uk/',
+ STAGING_FLAGS => { send_reports => 1, skip_checks => 0 },
}, sub {
subtest 'cobrand displays council name' => sub {
@@ -24,7 +32,16 @@ subtest 'cobrand displays council name' => sub {
$mech->content_contains('Buckinghamshire');
};
-$mech->create_problems_for_body(1, $body->id, 'On Road', {
+subtest 'cobrand displays correct categories' => sub {
+ my $json = $mech->get_ok_json('/report/new/ajax?latitude=51.615559&longitude=-0.556903');
+ is @{$json->{bodies}}, 2, 'Both Chiltern and Bucks returned';
+ like $json->{category}, qr/Flytipping/, 'Flytipping displayed';
+ unlike $json->{category}, qr/Graffiti/, 'Graffiti not displayed';
+ $json = $mech->get_ok_json('/report/new/category_extras?latitude=51.615559&longitude=-0.556903');
+ is @{$json->{bodies}}, 2, 'Still both Chiltern and Bucks returned';
+};
+
+my ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', {
category => 'Flytipping', cobrand => 'fixmystreet',
latitude => 51.812244, longitude => -0.827363,
});
@@ -32,19 +49,35 @@ $mech->create_problems_for_body(1, $body->id, 'On Road', {
subtest 'flytipping on road sent to extra email' => sub {
FixMyStreet::Script::Reports::send();
my $email = $mech->get_email;
- my $tfb = join('', 'crmbusinesssupport', '@', 'buckscc.gov.uk');
- is $email->header('To'), '"Buckinghamshire" <flytipping@example.org>, "TfB" <' . $tfb . '>';
+ my $tfb = join('', 'illegaldumpingcosts', '@', 'buckscc.gov.uk');
+ is $email->header('To'), '"TfB" <' . $tfb . '>';
+ $report->discard_changes;
+ is $report->external_id, 248, 'Report has right external ID';
};
-$mech->create_problems_for_body(1, $body->id, 'Off Road', {
+($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', {
+ category => 'Potholes', cobrand => 'fixmystreet',
+ latitude => 51.812244, longitude => -0.827363,
+});
+
+subtest 'pothole on road not sent to extra email' => sub {
+ $mech->clear_emails_ok;
+ FixMyStreet::Script::Reports::send();
+ $mech->email_count_is(0);
+ $report->discard_changes;
+ is $report->external_id, 248, 'Report has right external ID';
+};
+
+($report) = $mech->create_problems_for_body(1, $district->id, 'Off Road', {
category => 'Flytipping', cobrand => 'fixmystreet',
latitude => 51.813173, longitude => -0.826741,
});
-subtest 'flytipping on road sent to extra email' => sub {
- $mech->clear_emails_ok;
+subtest 'flytipping off road sent to extra email' => sub {
FixMyStreet::Script::Reports::send();
my $email = $mech->get_email;
- is $email->header('To'), '"Buckinghamshire" <flytipping@example.org>';
+ is $email->header('To'), '"Chiltern" <flytipping@chiltern>';
+ $report->discard_changes;
+ is $report->external_id, undef, 'Report has right external ID';
};
};
diff --git a/templates/web/base/tokens/confirm_problem.html b/templates/web/base/tokens/confirm_problem.html
index ff9882d4b..57ba42a54 100644
--- a/templates/web/base/tokens/confirm_problem.html
+++ b/templates/web/base/tokens/confirm_problem.html
@@ -31,6 +31,12 @@
[% TRY %][% INCLUDE 'tokens/_extras_confirm.html' %][% CATCH file %][% END %]
+ <p class="confirmation-again">
+ <a href="/report/new?latitude=[% report.latitude %]&amp;longitude=[% report.longitude %]" class="btn btn-primary">
+ [% loc('Report another problem here') %]
+ </a>
+ </p>
+
</div>
[% INCLUDE
diff --git a/web/cobrands/bathnes/assets.js b/web/cobrands/bathnes/assets.js
index e455d78e9..16ecb3076 100644
--- a/web/cobrands/bathnes/assets.js
+++ b/web/cobrands/bathnes/assets.js
@@ -23,7 +23,7 @@ fixmystreet.maps.banes_defaults = {
asset_category: "",
asset_item: "asset",
asset_type: 'spot',
- max_resolution: 2.388657133579254,
+ max_resolution: 4.777314267158508,
min_resolution: 0.5971642833948135,
asset_id_field: 'feature_no',
attributes: null,
diff --git a/web/cobrands/bristol/assets.js b/web/cobrands/bristol/assets.js
index 6d2020bfe..1b32379dc 100644
--- a/web/cobrands/bristol/assets.js
+++ b/web/cobrands/bristol/assets.js
@@ -7,7 +7,10 @@ if (!fixmystreet.maps) {
var options = {
wfs_url: "https://maps.bristol.gov.uk/arcgis/services/ext/FixMyStreetSupportData/MapServer/WFSServer",
wfs_feature: "COD_ASSETS_POINT",
- max_resolution: 0.33072982812632296,
+ max_resolution: {
+ 'bristol': 0.33072982812632296,
+ 'fixmystreet': 4.777314267158508
+ },
min_resolution: 0.00001,
asset_id_field: 'COD_ASSET_ID',
asset_type: 'spot',
@@ -17,6 +20,7 @@ var options = {
usrn: 'COD_USRN'
},
body: "Bristol City Council",
+ srsName: "EPSG:27700",
geometryName: 'SHAPE'
};
diff --git a/web/cobrands/bromley/assets.js b/web/cobrands/bromley/assets.js
index 959148e5d..32c00d32d 100644
--- a/web/cobrands/bromley/assets.js
+++ b/web/cobrands/bromley/assets.js
@@ -16,7 +16,7 @@ var defaults = {
},
format_class: OpenLayers.Format.GML.v3.MultiCurveFix,
asset_type: 'spot',
- max_resolution: 2.388657133579254,
+ max_resolution: 4.777314267158508,
min_resolution: 0.5971642833948135,
asset_id_field: 'CENTRAL_AS',
geometryName: 'msGeometry',
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index 82301c4f2..57b2317a4 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -16,7 +16,7 @@ var defaults = {
},
format_class: OpenLayers.Format.GML.v3.MultiCurveFix,
asset_type: 'spot',
- max_resolution: 2.388657133579254,
+ max_resolution: 4.777314267158508,
min_resolution: 0.5971642833948135,
asset_id_field: 'central_as',
attributes: {
@@ -173,10 +173,15 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
actions: {
found: function(layer, feature) {
fixmystreet.body_overrides.allow_send(layer.fixmystreet.body);
+ fixmystreet.body_overrides.remove_only_send();
if (fixmystreet.assets.selectedFeature()) {
hide_responsibility_errors();
enable_report_form();
} else if (OpenLayers.Util.indexOf(bucks_types, feature.attributes.feature_ty) != -1) {
+ var cat = $('select#form_category').val();
+ if (cat === 'Flytipping') {
+ fixmystreet.body_overrides.only_send(layer.fixmystreet.body);
+ }
hide_responsibility_errors();
enable_report_form();
} else if (is_only_body(layer.fixmystreet.body)) {
@@ -192,6 +197,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
// probably a field or something. Show an error to that effect,
// unless an asset is selected.
fixmystreet.body_overrides.do_not_send(layer.fixmystreet.body);
+ fixmystreet.body_overrides.remove_only_send();
if (fixmystreet.assets.selectedFeature()) {
fixmystreet.body_overrides.allow_send(layer.fixmystreet.body);
hide_responsibility_errors();
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index f53d26bbb..31dcaec07 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -491,12 +491,17 @@ fixmystreet.assets = {
options.asset_category = [ options.asset_category ];
}
+ var max_resolution = options.max_resolution;
+ if (typeof max_resolution === 'object') {
+ max_resolution = max_resolution[fixmystreet.cobrand];
+ }
+
var layer_options = {
fixmystreet: options,
strategies: [new StrategyClass()],
protocol: protocol,
visibility: false,
- maxResolution: options.max_resolution,
+ maxResolution: max_resolution,
minResolution: options.min_resolution,
styleMap: options.stylemap || get_asset_stylemap(),
assets: true
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index c749ebcf9..63f4c16b4 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -1221,6 +1221,10 @@ fixmystreet.display = {
fixmystreet.maps.click_control.activate();
}
+ if (fixmystreet.maps.setup_inspector) {
+ fixmystreet.maps.setup_inspector();
+ }
+
if (typeof callback === 'function') {
callback();
}
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index 4d7ff2c37..00e2df7d7 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -2160,6 +2160,12 @@ a#geolocate_link.loading, .btn--geolocate.loading {
}
}
+.confirmation-again {
+ margin-top: 2em;
+ color: inherit;
+ font-size: 1em;
+}
+
/* Questionnaire page */
.questionnaire-report-header {
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 6f42d13d1..7253d46c8 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -178,6 +178,10 @@ $.extend(fixmystreet.utils, {
return lonlat;
},
+ setup_inspector: function() {
+ setup_inspector_marker_drag();
+ },
+
markers_list: function(pins, transform) {
var markers = [];
var size = fixmystreet.maps.marker_size();