aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-02-19 17:27:52 +0000
committerDave Arter <davea@mysociety.org>2019-12-09 12:48:12 +0000
commitbce71d7bb2f7041cf2b5b01a4a1548b0faa068d3 (patch)
tree40e86974a8aae2462a37eb60f757200ea1e1e42d /perllib/FixMyStreet
parent78fe8a1e3c880acf693f2bdefb7cba5882815bc9 (diff)
[TfL] Initial cobrand design & set up
Co-Authored-By: Dave Arter <davea@mysociety.org> Co-Authored-By: Chris Mytton <chrism@mysociety.org>
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/TfL.pm64
1 files changed, 64 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm
new file mode 100644
index 000000000..6dec98b26
--- /dev/null
+++ b/perllib/FixMyStreet/Cobrand/TfL.pm
@@ -0,0 +1,64 @@
+package FixMyStreet::Cobrand::TfL;
+use parent 'FixMyStreet::Cobrand::Whitelabel';
+
+use strict;
+use warnings;
+
+sub council_area_id { return [
+ 2511, 2489, 2494, 2488, 2482, 2505, 2512, 2481, 2484, 2495,
+ 2493, 2508, 2502, 2509, 2487, 2485, 2486, 2483, 2507, 2503,
+ 2480, 2490, 2492, 2500, 2510, 2497, 2499, 2491, 2498, 2506,
+ 2496, 2501, 2504
+]; }
+sub council_area { return 'TfL'; }
+sub council_name { return 'TfL'; }
+sub council_url { return 'tfl'; }
+sub area_types { [ 'LBO' ] }
+sub is_council { 0 }
+
+sub area_check {
+ my ( $self, $params, $context ) = @_;
+
+ my $councils = $params->{all_areas};
+ my $council_match = grep { $councils->{$_} } @{ $self->council_area_id };
+
+ return 1 if $council_match;
+ return ( 0, $self->area_check_error_message($params, $context) );
+}
+
+sub enter_postcode_text {
+ my ($self) = @_;
+ return 'Enter a London postcode, or street name and area';
+}
+
+sub privacy_policy_url { 'https://tfl.gov.uk/corporate/privacy-and-cookies/reporting-street-problems' }
+
+sub about_hook {
+ my $self = shift;
+ my $c = $self->{c};
+
+ if ($c->stash->{template} eq 'about/privacy.html') {
+ $c->res->redirect($self->privacy_policy_url);
+ $c->detach;
+ }
+}
+
+sub body {
+ # Overridden because UKCouncils::body excludes TfL
+ FixMyStreet::DB->resultset('Body')->search({ name => 'TfL' })->first;
+}
+
+# These need to be overridden so the method in UKCouncils doesn't create
+# a fixmystreet.com link (because of the false-returning owns_problem call)
+sub relative_url_for_report { "" }
+sub base_url_for_report {
+ my $self = shift;
+ return $self->base_url;
+}
+
+sub categories_restriction {
+ my ($self, $rs) = @_;
+ return $rs->search( { 'body.name' => 'TfL' } );
+}
+
+1;