aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-08-30 12:39:07 +0100
committerDave Arter <davea@mysociety.org>2019-10-21 14:29:35 +0100
commiteb5bbc4d12d81d2ecae971102050ac67cf050c00 (patch)
treecb226a2384e5c53378127e91eca7543cdb435801
parent50d0daa3f4d09f06d622d9c8f443d70a27098286 (diff)
[Peterborough] Confirm-specific configuration
- Apply Confirm validation rules - Add admin_user_domain and Confirm-required open311 fields - Prefix Open311 updates with notice that it’s come from FMS
-rw-r--r--perllib/FixMyStreet/Cobrand/Peterborough.pm31
-rw-r--r--templates/web/peterborough/footer_extra_js.html13
-rw-r--r--web/cobrands/fixmystreet-uk-councils/council_validation_rules.js1
3 files changed, 45 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm
index 4e5b75751..5ea847c89 100644
--- a/perllib/FixMyStreet/Cobrand/Peterborough.pm
+++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm
@@ -4,6 +4,9 @@ use parent 'FixMyStreet::Cobrand::Whitelabel';
use strict;
use warnings;
+use Moo;
+with 'FixMyStreet::Roles::ConfirmValidation';
+
sub council_area_id { 2566 }
sub council_area { 'Peterborough' }
sub council_name { 'Peterborough City Council' }
@@ -29,4 +32,32 @@ sub geocoder_munge_results {
$result->{display_name} =~ s/, City of Peterborough, East of England, England//;
}
+sub admin_user_domain { "peterborough.gov.uk" }
+
+sub open311_config {
+ my ($self, $row, $h, $params) = @_;
+
+ my $extra = $row->get_extra_fields;
+ push @$extra,
+ { name => 'report_url',
+ value => $h->{url} },
+ { name => 'title',
+ value => $row->title },
+ { name => 'description',
+ value => $row->detail };
+
+ # remove the emergency category which is informational only
+ @$extra = grep { $_->{name} ne 'emergency' } @$extra;
+
+ $row->set_extra_fields(@$extra);
+}
+
+sub open311_munge_update_params {
+ my ($self, $params, $comment, $body) = @_;
+
+ # Peterborough want to make it clear in Confirm when an update has come
+ # from FMS.
+ $params->{description} = "[Customer FMS update] " . $params->{description};
+}
+
1;
diff --git a/templates/web/peterborough/footer_extra_js.html b/templates/web/peterborough/footer_extra_js.html
new file mode 100644
index 000000000..756ef495a
--- /dev/null
+++ b/templates/web/peterborough/footer_extra_js.html
@@ -0,0 +1,13 @@
+[% scripts.push(
+ version('/cobrands/fixmystreet-uk-councils/js.js'),
+ version('/cobrands/fixmystreet-uk-councils/council_validation_rules.js'),
+) %]
+[%~
+IF bodyclass.match('mappage');
+ scripts.push(
+ version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'),
+ version('/cobrands/fixmystreet/assets.js'),
+ version('/cobrands/highways/assets.js'),
+ );
+END
+%]
diff --git a/web/cobrands/fixmystreet-uk-councils/council_validation_rules.js b/web/cobrands/fixmystreet-uk-councils/council_validation_rules.js
index f693f59f8..3f350a82f 100644
--- a/web/cobrands/fixmystreet-uk-councils/council_validation_rules.js
+++ b/web/cobrands/fixmystreet-uk-councils/council_validation_rules.js
@@ -45,6 +45,7 @@ body_validation_rules = {
maxlength: 50
}
},
+ 'Peterborough City Council': confirm_validation_rules,
'Rutland County Council': {
title: {
required: true,