Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions perllib/FixMyStreet/App/Controller/Reports.pm
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ sub check_canonical_url : Private {
my $body_short = $c->cobrand->short_name( $c->stash->{body} );
my $url_short = URI::Escape::uri_escape_utf8($q_body);
$url_short =~ s/%2B/+/g;
$url_short =~ s/%26/&/g;
$c->detach( 'redirect_body' ) unless $body_short eq $url_short;
}

Expand Down
94 changes: 94 additions & 0 deletions perllib/FixMyStreet/Cobrand/CanalRiverTrust.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
=head1 NAME

FixMyStreet::Cobrand::CanalRiverTrust - code specific to the Canal & River Trust cobrand

=head1 SYNOPSIS

The Canal & River Trust is a charity looking after 2,000 miles of canals and
rivers, along with reservoirs and structures, in England and Wales.

=head1 DESCRIPTION

=cut

package FixMyStreet::Cobrand::CanalRiverTrust;
use parent 'FixMyStreet::Cobrand::UK';

use strict;
use warnings;
use utf8;

sub council_name { 'Canal & River Trust' }
sub council_url { 'canalrivertrust' }
sub site_key { 'canalrivertrust' }
sub restriction { { cobrand => shift->moniker } }
sub hide_areas_on_reports { 1 }
sub suggest_duplicates { 1 }
sub all_reports_single_body { { name => 'Canal & River Trust' } }

=over 4

=item * It is not a council, so inherits from UK, not UKCouncils, but a number of functions are shared with what councils do

=cut

sub cut_off_date { '' }
sub problems_restriction { FixMyStreet::Cobrand::UKCouncils::problems_restriction($_[0], $_[1]) }
sub problems_on_map_restriction { $_[0]->problems_restriction($_[1]) }
sub problems_sql_restriction { FixMyStreet::Cobrand::UKCouncils::problems_sql_restriction($_[0], $_[1]) }
sub users_restriction { FixMyStreet::Cobrand::UKCouncils::users_restriction($_[0], $_[1]) }
sub updates_restriction { FixMyStreet::Cobrand::UKCouncils::updates_restriction($_[0], $_[1]) }
sub base_url { FixMyStreet::Cobrand::UKCouncils::base_url($_[0]) }
sub contact_name { FixMyStreet::Cobrand::UKCouncils::contact_name($_[0]) }
sub contact_email { FixMyStreet::Cobrand::UKCouncils::contact_email($_[0]) }
sub users_staff_admin { FixMyStreet::Cobrand::UKCouncils::users_staff_admin($_[0]) }
sub admin_allow_user { FixMyStreet::Cobrand::UKCouncils::admin_allow_user($_[0], $_[1]) }

sub enter_postcode_text { 'Enter a location, bridge number or postcode' }
sub example_places { ['Lock 47, Fazeley', 'Bridge 33, Kennet and Avon'] }
sub admin_user_domain { 'canalrivertrust.org.uk' }
sub abuse_reports_only { 1 }

sub fetch_area_children {
my $self = shift;

my $areas = FixMyStreet::MapIt::call('areas', $self->area_types_for_admin);
$areas = {
map { $_->{id} => $_ }
grep { ($_->{country} || 'E') =~ /^[EW]$/ }
values %$areas
};
return $areas;
}

=head2 Report categories

There is special handling of body/contacts; categories must end "(CRT)"
(this is stripped for display).

=cut

sub munge_report_new_bodies {
my ($self, $bodies) = @_;
# On the cobrand there is only the Canals body
%$bodies = map { $_->id => $_ } grep { $_->get_column('name') eq 'Canal & River Trust' } values %$bodies;
}

sub munge_report_new_contacts {
my ($self, $contacts) = @_;

my $code = 'CRT';
foreach my $c (@$contacts) {
my $clean_name = $c->category_display;
if ($clean_name =~ s/ \($code\)//) {
$c->set_extra_metadata(display_name => $clean_name);
}
}
}

sub admin_contact_validate_category {
my ( $self, $category ) = @_;
return "(CRT)" eq substr($category, -5) ? "" : "Category must end with (CRT).";
}

1;
1 change: 1 addition & 0 deletions perllib/FixMyStreet/Cobrand/UK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ sub short_name {
# Special case Durham as it's the only place with two councils of the same name
return 'Durham+County' if $name eq 'Durham County Council';
return 'Durham+City' if $name eq 'Durham City Council';
return 'Canal+&+River+Trust' if $name eq 'Canal & River Trust'; # Keep ampersand

$name =~ s/^(Royal|London) Borough of //;
$name =~ s/ (Borough|City|District|County|Parish|Town) Council$//;
Expand Down
24 changes: 24 additions & 0 deletions templates/email/canalrivertrust/_email_color_overrides.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[%

primary = '#1e29f5'
white = '#fff'
grey_pale = '#F9F7F5'

body_background_color = grey_pale
body_text_color = color_black

header_background_color = primary
header_text_color = white

link_text_color = primary

secondary_column_background_color = color_white

button_background_color = primary
button_text_color = color_white

logo_file = 'logo-desktop.png'
logo_width = "242" # pixel measurement, but without 'px' suffix
logo_height = "80" # pixel measurement, but without 'px' suffix

%]
5 changes: 5 additions & 0 deletions templates/email/canalrivertrust/_email_setting_overrides.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[%

button_style = "display: inline-block; border: 10px solid $button_background_color; border-width: 10px 15px; border-radius: 3px; background-color: $button_background_color; color: $button_text_color; font-size: 18px; line-height: 21px; font-weight: $button_font_weight; text-decoration: none;"

%]
2 changes: 1 addition & 1 deletion templates/web/base/reports/_body_name.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[% body.name %]
[% body.name | safe %][%# Going to be escaped again on display %]
Loading
Loading