aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/TfL.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/TfL.pm')
-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;