aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpanfile1
-rw-r--r--perllib/CrossSell.pm26
-rw-r--r--perllib/FixMyStreet/App.pm1
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm11
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm5
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm25
-rw-r--r--perllib/FixMyStreet/App/Controller/Tokens.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm8
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm18
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm5
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm2
-rw-r--r--perllib/Utils.pm4
-rw-r--r--t/app/controller/contact.t111
-rw-r--r--t/app/controller/dashboard.t16
-rw-r--r--t/app/controller/report_new.t117
-rw-r--r--templates/web/default/contact/index.html2
-rw-r--r--templates/web/default/contact/who.html (renamed from templates/web/default/report/extra_analytics.html)0
-rw-r--r--templates/web/default/tokens/confirm_problem.html1
-rw-r--r--templates/web/fixmystreet/contact/blurb.html15
-rw-r--r--templates/web/fixmystreet/contact/index.html11
-rw-r--r--templates/web/fixmystreet/contact/who.html77
-rw-r--r--templates/web/fixmystreet/footer.html18
-rw-r--r--templates/web/fixmystreet/report/display.html1
-rw-r--r--templates/web/fixmystreet/report/extra_analytics.html8
-rw-r--r--templates/web/fixmystreet/tracking_code.html12
-rw-r--r--templates/web/southampton/header.html2
-rw-r--r--web/cobrands/fixmystreet/images/google_play_logo.pngbin0 -> 8913 bytes
-rw-r--r--web/cobrands/fixmystreet/images/itunes_store_logo.pngbin0 -> 3394 bytes
30 files changed, 454 insertions, 52 deletions
diff --git a/cpanfile b/cpanfile
index ca82f9ae2..158e10cd1 100644
--- a/cpanfile
+++ b/cpanfile
@@ -85,6 +85,7 @@ feature 'uk', 'FixMyStreet.com specific requirements' => sub {
# # East Hampshire
# requires 'SOAP::Lite';
# Barnet
+ # TODO: This can perhaps be removed since Barnet switched to email for problem reports
requires 'SOAP::WSDL';
};
diff --git a/perllib/CrossSell.pm b/perllib/CrossSell.pm
index ca4eebdb3..f9bb73d6a 100644
--- a/perllib/CrossSell.pm
+++ b/perllib/CrossSell.pm
@@ -161,6 +161,30 @@ for campaigns too.
EOF
}
+sub display_app_links {
+ return <<EOF;
+<h1 style="padding-top:0.5em">New! FixMyStreet Apps for Apple and Android</h1>
+<p>
+We've built all-new FixMyStreet phone apps, for your use. Key
+improvements include offline reporting (for where there is bad signal)
+and a better interface for adding problem reports more quickly and
+easily. Please give the apps a go and tell us what you think.
+</p>
+
+<p>
+<a href="https://play.google.com/store/apps/details?id=org.mysociety.FixMyStreet">
+ <img alt="FixMyStreet Android app on Google Play"
+ src="/cobrands/fixmystreet/images/google_play_logo.png" />
+</a>
+
+<a href="https://itunes.apple.com/gb/app/fixmystreet/id297456545">
+ <img alt="FixMyStreet app on the App Store"
+ src="/cobrands/fixmystreet/images/itunes_store_logo.png" />
+</a><br>
+</p>
+EOF
+}
+
# Not currently used, needs more explanation and testing; perhaps in future.
sub display_gny_groups {
my ($lon, $lat) = @_;
@@ -222,7 +246,7 @@ sub display_advert ($$;$%) {
#unless (defined $data{done_tms} && $data{done_tms}==1) {
$c->stash->{scratch} = 'advert=wtt';
return '<div style="margin: 0 5em; border-top: dotted 1px #666666;">'
- . display_wtt_link()
+ . display_app_links()
. '</div>';
$c->stash->{scratch} = 'advert=news';
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 1664f0f30..13617a3c0 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -95,6 +95,7 @@ __PACKAGE__->setup();
after 'prepare_headers' => sub {
my $self = shift;
$self->req->secure( 1 ) if $self->config->{BASE_URL} eq 'https://www.zueriwieneu.ch';
+ $self->req->secure( 1 ) if $self->config->{BASE_URL} eq 'http://www.fixmystreet.com' && $self->req->headers->header('Host') eq 'fix.bromley.gov.uk';
};
# set up DB handle for old code
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 9c0018f38..cfe165f43 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -774,7 +774,8 @@ sub report_edit : Path('report_edit') : Args(1) {
if ( $c->req->param('remove_photo') ) {
$problem->photo(undef);
}
- if ( $new_state eq 'hidden' ) {
+
+ if ( $c->req->param('remove_photo') || $new_state eq 'hidden' ) {
unlink glob FixMyStreet->path_to( 'web', 'photo', $problem->id . '.*' );
}
@@ -916,6 +917,10 @@ sub update_edit : Path('update_edit') : Args(1) {
$update->photo(undef);
}
+ if ( $c->req->param('remove_photo') || $new_state eq 'hidden' ) {
+ unlink glob FixMyStreet->path_to( 'web', 'photo', 'c', $update->id . '.*' );
+ }
+
$update->name( $c->req->param('name') || '' );
$update->text( $c->req->param('text') );
$update->anonymous( $c->req->param('anonymous') );
@@ -939,10 +944,6 @@ sub update_edit : Path('update_edit') : Args(1) {
}
}
- if ( $new_state eq 'hidden' ) {
- unlink glob FixMyStreet->path_to( 'web', 'photo', 'c', $update->id . '.*' );
- }
-
$update->update;
$c->stash->{status_message} = '<p><em>' . _('Updated!') . '</em></p>';
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 7ba18ed2d..6bc6e90ef 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -108,6 +108,11 @@ sub validate : Private {
if !mySociety::EmailUtil::is_valid_email( $c->req->param('em') );
}
+ %field_errors = (
+ %field_errors,
+ $c->cobrand->extra_contact_validation($c)
+ );
+
push @errors, _('Illegal ID')
if $c->req->param('id') && $c->req->param('id') !~ /^[1-9]\d*$/
or $c->req->param('update_id')
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index b5f65d8c8..25c6e1923 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -195,7 +195,7 @@ sub export_as_csv {
(defined $value and length $value) ? ($_, $value) : ()
} sort keys %where };
- my $csv = Text::CSV->new();
+ my $csv = Text::CSV->new({ binary => 1, eol => "\n" });
$csv->combine(
'Report ID',
'Title',
@@ -264,7 +264,7 @@ sub export_as_csv {
}
$c->res->content_type('text/csv; charset=utf-8');
$c->res->header('content-disposition' => "attachment; filename=${filename}.csv");
- $c->res->body( join "\n", @body );
+ $c->res->body( join "", @body );
}
sub updates_search : Private {
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 081256fe2..13a347a90 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -167,6 +167,9 @@ sub format_problem_for_display : Private {
}
$c->stash->{extra_name_info} = $problem->bodies_str && $problem->bodies_str eq '2482' ? 1 : 0;
+ if ( $c->sessionid && $c->flash->{created_report} ) {
+ $c->stash->{created_report} = $c->flash->{created_report};
+ }
$c->forward('generate_map_tags');
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 761215344..1e9f83aec 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -624,15 +624,13 @@ sub setup_categories_and_bodies : Private {
_('Empty public building - school, hospital, etc.')
);
- } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') {
+ } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY
+ && $first_area->{id} != COUNCIL_ID_BARNET
+ && $first_area->{type} eq 'LBO') {
$bodies_to_list{ $first_body->id } = 1;
my @local_categories;
- if ($first_area->{id} == COUNCIL_ID_BARNET) {
- @local_categories = sort keys %{ Utils::barnet_categories() }
- } else {
- @local_categories = sort keys %{ Utils::london_categories() }
- }
+ @local_categories = sort keys %{ Utils::london_categories() };
@category_options = (
_('-- Pick a category --'),
@local_categories
@@ -853,15 +851,10 @@ sub process_report : Private {
$report->extra( \%extra );
}
- } elsif ( $first_area->{id} == COUNCIL_ID_BARNET ) {
+ } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY
+ && $first_area->{id} != COUNCIL_ID_BARNET
+ && $first_area->{type} eq 'LBO') {
- unless ( exists Utils::barnet_categories()->{ $report->category } ) {
- $c->stash->{field_errors}->{category} = _('Please choose a category');
- }
- $report->bodies_str( $first_body->id );
-
- } elsif ( $first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') {
-
unless ( Utils::london_categories()->{ $report->category } ) {
$c->stash->{field_errors}->{category} = _('Please choose a category');
}
@@ -1155,7 +1148,9 @@ sub redirect_or_confirm_creation : Private {
$report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url;
}
$c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id);
- $c->flash->{created_report} = 'loggedin';
+ if ( $c->sessionid ) {
+ $c->flash->{created_report} = 'loggedin';
+ }
$c->res->redirect($report_uri);
$c->detach;
}
diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm
index 19130e25f..44cb2429d 100644
--- a/perllib/FixMyStreet/App/Controller/Tokens.pm
+++ b/perllib/FixMyStreet/App/Controller/Tokens.pm
@@ -102,7 +102,7 @@ sub confirm_problem : Path('/P') {
$c->res->redirect($report_uri);
}
- $c->flash->{created_report} = 'fromemail';
+ $c->stash->{created_report} = 'fromemail';
return 1;
}
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index d2af4949e..c8bae90e6 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -854,6 +854,14 @@ sub prettify_dt {
return Utils::prettify_dt( $dt, 1 );
}
+=head2 extra_contact_validation
+
+Perform any extra validation on the contact form.
+
+=cut
+
+sub extra_contact_validation { (); }
+
sub problem_as_hashref {
my $self = shift;
my $problem = shift;
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index c3a1f9d9d..ce62e206e 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -21,5 +21,23 @@ sub title_list {
return undef;
}
+sub extra_contact_validation {
+ my $self = shift;
+ my $c = shift;
+
+ my %errors;
+
+ $c->stash->{dest} = $c->req->param('dest');
+
+ $errors{dest} = "Please enter who your message is for"
+ unless $c->req->param('dest');
+
+ if ( $c->req->param('dest') eq 'council' || $c->req->param('dest') eq 'update' ) {
+ $errors{not_for_us} = 1;
+ }
+
+ return %errors;
+}
+
1;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 7b5460c51..3463ebab6 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -623,11 +623,10 @@ sub body {
# Note: this only makes sense when called on a problem that has been sent!
sub can_display_external_id {
my $self = shift;
- if ($self->external_id && $self->send_method_used &&
- ($self->send_method_used eq 'barnet' || $self->bodies_str =~ /2237/)) {
+ if ($self->external_id && $self->bodies_str =~ /2237/) {
return 1;
}
- return 0;
+ return 0;
}
# TODO Some/much of this could be moved to the template
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 5499af474..c108f7e29 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -376,6 +376,8 @@ sub send_reports {
if ( $row->subcategory ) {
$h{subcategory_line} = sprintf(_("Subcategory: %s"), $row->subcategory) . "\n\n";
+ } else {
+ $h{subcategory_line} = "\n\n";
}
$h{bodies_name} = join(_(' and '), @dear);
diff --git a/perllib/Utils.pm b/perllib/Utils.pm
index 27d604a59..7a22c888d 100644
--- a/perllib/Utils.pm
+++ b/perllib/Utils.pm
@@ -123,7 +123,9 @@ sub london_categories {
}
sub barnet_categories {
- # The values here are KBIDs from Barnet's system: see bin/send-reports for formatting
+ # The values here are KBIDs from Barnet's system: see bin/send-reports for formatting.
+ # They are no longer used since Barnet switched to email for delivery of problem reports.
+ # and can be removed when SendReport/Barnet.pm is removed.
if (mySociety::Config::get('STAGING_SITE')) { # note staging site must use different KBIDs
return {
'Street scene misc' => 14 # for test
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index 11e0d30cf..89a1db5b2 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -8,7 +8,7 @@ my $mech = FixMyStreet::TestMech->new;
$mech->get_ok('/contact');
$mech->title_like(qr/Contact Us/);
-$mech->content_contains("We'd love to hear what you think about this site");
+$mech->content_contains("It's often quickest to ");
my $problem_main;
@@ -282,6 +282,115 @@ for my $test (
};
}
+for my $test (
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => undef,
+ },
+ page_errors =>
+ [ 'There were problems with your report. Please see below.',
+ 'Please enter who your message is for',
+ ]
+ },
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'council',
+ },
+ page_errors =>
+ [ 'There were problems with your report. Please see below.',
+ 'You can only contact the team behind FixMyStreet using our contact form',
+ ]
+ },
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'update',
+ },
+ page_errors =>
+ [ 'There were problems with your report. Please see below.',
+ 'You can only contact the team behind FixMyStreet using our contact form',
+ ]
+ },
+ )
+{
+ subtest 'check submit page incorrect destination handling' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ }, sub {
+ $mech->host('www.fixmystreet.com');
+ $mech->get_ok( $test->{url} ? $test->{url} : '/contact' );
+ $mech->submit_form_ok( { with_fields => $test->{fields} } );
+ is_deeply $mech->page_errors, $test->{page_errors}, 'page errors';
+
+ # we santise this when we submit so need to remove it
+ delete $test->{fields}->{id}
+ if $test->{fields}->{id} and $test->{fields}->{id} eq 'invalid';
+ is_deeply $mech->visible_form_values, $test->{fields}, 'form values';
+
+ if ( $test->{fields}->{dest} and $test->{fields}->{dest} eq 'update' ) {
+ $mech->content_contains( 'www.writetothem.com', 'includes link to WTT if trying to update report' );
+ } elsif ( $test->{fields}->{dest} and $test->{fields}->{dest} eq 'council' ) {
+ $mech->content_lacks( 'www.writetothem.com', 'does not include link to WTT if trying to contact council' );
+ $mech->content_contains( 'should find contact details', 'mentions checking council website for contact details' );
+ }
+ }
+ };
+}
+
+for my $test (
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'help',
+ },
+ },
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'feedback',
+ },
+ },
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'from_council',
+ },
+ },
+ )
+{
+ subtest 'check email sent correctly with dest field set to us' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ }, sub {
+ $mech->clear_emails_ok;
+ $mech->get_ok('/contact');
+ $mech->submit_form_ok( { with_fields => $test->{fields} } );
+ $mech->content_contains('Thanks for your feedback');
+ $mech->email_count_is(1);
+ }
+ };
+}
+
$problem_main->delete;
done_testing();
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index a87232e9b..4e62028b5 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -609,9 +609,19 @@ FixMyStreet::override_config {
}
subtest 'export as csv' => sub {
+ make_problem( {
+ detail => "this report\nis split across\nseveral lines",
+ state => "confirmed",
+ conf_dt => DateTime->now(),
+ } );
$mech->get_ok('/dashboard?export=1');
- my @lines = split /\n/, $mech->content;
- is scalar @lines, 6, '1 (header) + 5 (reports) = 6 lines';
+ open my $data_handle, '<', \$mech->content;
+ my $csv = Text::CSV->new( { binary => 1 } );
+ my @rows;
+ while ( my $row = $csv->getline( $data_handle ) ) {
+ push @rows, $row;
+ }
+ is scalar @rows, 7, '1 (header) + 6 (reports) = 7 lines';
};
};
restore_time;
@@ -623,7 +633,7 @@ sub make_problem {
title => 'a problem',
name => 'a user',
anonymous => 1,
- detail => 'some detail',
+ detail => $args->{detail} || 'some detail',
state => $args->{state},
confirmed => $args->{conf_dt},
whensent => $args->{conf_dt},
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 84258f338..98b0175f8 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -46,6 +46,7 @@ for my $body (
{ id => 2482, name => 'Bromley Council' },
{ id => 2240, name => 'Staffordshire County Council' },
{ id => 2434, name => 'Lichfield District Council' },
+ { id => 2504, name => 'Westminster City Council' },
) {
$mech->create_body_ok($body->{id}, $body->{name});
}
@@ -825,7 +826,7 @@ foreach my $test (
$mech->submit_form_ok(
{
with_fields => {
- title => "Test Report at café",
+ title => "Test Report at café",
detail => 'Test report details.',
photo => '',
name => 'Joe Bloggs',
@@ -1481,6 +1482,120 @@ subtest "categories from deleted bodies shouldn't be visible for new reports" =>
};
};
+subtest "extra google analytics code displayed on logged in problem creation" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ BASE_URL => 'http://www.fixmystreet.com',
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ # check that the user does not exist
+ my $test_email = 'test-2@example.com';
+
+ $mech->clear_emails_ok;
+ my $user = $mech->log_in_ok($test_email);
+
+ # setup the user.
+ ok $user->update(
+ {
+ name => 'Test User',
+ phone => '01234 567 890',
+ }
+ ),
+ "set users details";
+
+ # submit initial pc form
+ $mech->get_ok('/around');
+ $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR', } },
+ "submit location" );
+
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
+
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ title => "Test Report at café",
+ detail => 'Test report details.',
+ photo => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ phone => '07903 123 456',
+ category => 'Trees',
+ }
+ },
+ "submit good details"
+ );
+
+ # find the report
+ my $report = $user->problems->first;
+ ok $report, "Found the report";
+
+ # check that we got redirected to /report/
+ is $mech->uri->path, "/report/" . $report->id, "redirected to report page";
+
+ $mech->content_contains( "extra = '?created_report", 'extra google code present' );
+
+ # cleanup
+ $mech->delete_user($user);
+ };
+};
+
+subtest "extra google analytics code displayed on email confirmation problem creation" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ BASE_URL => 'http://www.fixmystreet.com',
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->log_out_ok;
+ $mech->clear_emails_ok;
+
+ $mech->get_ok('/');
+ $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR' } },
+ "submit location" );
+ $mech->follow_link_ok(
+ { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link"
+ );
+
+ my $fields = $mech->visible_form_values('mapSkippedForm');
+ my $submission_fields = {
+ title => "Test Report",
+ detail => 'Test report details.',
+ photo => '',
+ email => 'firstlast@example.com',
+ name => 'Test User',
+ may_show_name => '1',
+ phone => '07903 123 456',
+ category => 'Trees',
+ password_register => '',
+ };
+
+ $mech->submit_form_ok( { with_fields => $submission_fields },
+ "submit good details" );
+
+ my $email = $mech->get_email;
+ ok $email, "got an email";
+ like $email->body, qr/confirm the problem/i, "confirm the problem";
+
+ my ($url) = $email->body =~ m{(https?://\S+)};
+ ok $url, "extracted confirm url '$url'";
+
+ # confirm token in order to update the user details
+ $mech->get_ok($url);
+
+ $mech->content_contains( "extra = '?created_report", 'extra google code present' );
+
+ my $user =
+ FixMyStreet::App->model('DB::User')
+ ->find( { email => 'firstlast@example.com' } );
+
+ $user->problems->delete;
+ $user->alerts->delete;
+ $user->delete;
+ };
+};
+
$contact1->delete;
$contact2->delete;
$contact3->delete;
diff --git a/templates/web/default/contact/index.html b/templates/web/default/contact/index.html
index 73e94fb33..8789fd03e 100644
--- a/templates/web/default/contact/index.html
+++ b/templates/web/default/contact/index.html
@@ -83,6 +83,8 @@
<label for="form_subject">[% loc('Subject:') %]</label>
<input type="text" class="required" name="subject" id="form_subject" value="[% subject | html %]" size="30"></div>
+[% INCLUDE 'contact/who.html' %]
+
[% IF field_errors.message %]
<div class="form-error">[% field_errors.message %]</div>
[% END %]
diff --git a/templates/web/default/report/extra_analytics.html b/templates/web/default/contact/who.html
index e69de29bb..e69de29bb 100644
--- a/templates/web/default/report/extra_analytics.html
+++ b/templates/web/default/contact/who.html
diff --git a/templates/web/default/tokens/confirm_problem.html b/templates/web/default/tokens/confirm_problem.html
index 51b459925..723d515e1 100644
--- a/templates/web/default/tokens/confirm_problem.html
+++ b/templates/web/default/tokens/confirm_problem.html
@@ -28,5 +28,4 @@ You can <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]
[% display_crosssell_advert( problem.user.email, problem.name ) %]
-[% INCLUDE 'report/extra_analytics.html' %]
[% INCLUDE 'footer.html' %]
diff --git a/templates/web/fixmystreet/contact/blurb.html b/templates/web/fixmystreet/contact/blurb.html
new file mode 100644
index 000000000..21a4ae715
--- /dev/null
+++ b/templates/web/fixmystreet/contact/blurb.html
@@ -0,0 +1,15 @@
+[% IF c.cobrand.moniker == 'fixmystreet' %]
+<h3>Send a message to FixMyStreet's technical support team</h3>
+
+<h4>If you have questions about FixMyStreet</h4>
+[% END %]
+
+<p>
+[% tprintf( loc("It's often quickest to <a href=\"%s\">check our FAQs</a> and see if the answer is there."), c.uri_for('/faq') ) %]
+</p>
+
+<p>
+[% loc('Please do <strong>not</strong> report problems through this form; messages go to
+the team behind FixMyStreet, not a council. To report a problem,
+please <a href="/">go to the front page</a> and follow the instructions.') %]
+</p>
diff --git a/templates/web/fixmystreet/contact/index.html b/templates/web/fixmystreet/contact/index.html
index dfef39b9f..44aa5c2e4 100644
--- a/templates/web/fixmystreet/contact/index.html
+++ b/templates/web/fixmystreet/contact/index.html
@@ -16,7 +16,11 @@
</aside>
</div>
+[% IF c.cobrand.moniker == 'fixmystreet' %]
+<h1>FixMyStreet technical support</h1>
+[% ELSE %]
<h1>[% loc('Contact the team') %]</h1>
+[% END %]
<form method="post" action="/contact/submit" class="validate">
<fieldset>
@@ -94,6 +98,7 @@
[% END %]
<input type="text" class="required" name="subject" id="form_subject" value="[% subject | html %]" size="30">
+ [% INCLUDE 'contact/who.html' %]
<label for="form_message">[% loc('Message') %]</label>
[% IF field_errors.message %]
@@ -107,6 +112,12 @@
</fieldset>
</form>
+<h4>[% loc("Don't like forms?") %]</h4>
+
+<p>
+[% tprintf( loc("You can contact technical support on <a href='mailto:%s'>%s</a>"), contact_email, contact_email) %]
+</p>
+
[% TRY %][% INCLUDE 'contact/address.html' %][% CATCH file %][% END %]
[% INCLUDE 'footer.html' pagefooter = 'yes' %]
diff --git a/templates/web/fixmystreet/contact/who.html b/templates/web/fixmystreet/contact/who.html
new file mode 100644
index 000000000..49f22b612
--- /dev/null
+++ b/templates/web/fixmystreet/contact/who.html
@@ -0,0 +1,77 @@
+[% IF c.cobrand.moniker == 'fixmystreet' %]
+ <h4>Topic:</h4>
+
+ [% IF field_errors.dest %]
+ <div class="form-error">[% field_errors.dest %]</div>
+ [% ELSIF field_errors.not_for_us %]
+ <div class="form-error">You can only contact the team behind FixMyStreet using our contact form</div>
+
+ [% IF dest == 'council' %]
+ <p>
+ We’re not the council: we just run this website which helps you report issues
+ to them.
+ </p>
+
+ <p>
+ <strong>If you want to report a street problem</strong>, return to the
+ FixMyStreet homepage and enter your postcode. You can then make a report.
+ We'll send it to your council, and publish it on FixMyStreet.
+ </p>
+
+ <p>
+ <strong>If your problem is not a street issue</strong>, or is <strong>not
+ suitable for publication on the site</strong>, then FixMyStreet isn't the
+ right place for it. You should find contact details on your council's own
+ website.
+ </p>
+ [% ELSIF dest == 'update' %]
+ <p>
+ FixMyStreet is great for reporting problems, but we don't fix them - your
+ council oversees that.
+ </p>
+
+ <p>
+ <strong>If you'd like to chase your report</strong>, please reply directly
+ to any response - or auto-reply - that your council sent you. Check that
+ it has your council's email address on it so that it goes to the right place.
+ </p>
+
+ <p>
+ It's a good idea to include the URL [web address] of your original FixMyStreet
+ report.
+ </p>
+
+ <p>
+ <strong>If you're not having any luck getting your community problems fixed</strong>,
+ you could try contacting your local councillor, using another useful mySociety site:
+ <a href="https://www.writetothem.com/">https://www.writetothem.com/</a>.
+ </p>
+
+ [% END %]
+ [% END %]
+
+ <div class="checkbox-group">
+ <input name="dest" id="dest_help" type="radio" value="help" class="required"[% IF dest AND dest == 'help' %] checked[% END %]>
+ <label class="inline" for="dest_help">I need help using the site</label>
+ </div>
+
+ <div class="checkbox-group">
+ <input name="dest" id="dest_feeback" type="radio" value="feeback" class="required"[% IF dest AND dest == 'feeback' %] checked[% END %]>
+ <label class="inline" for="dest_feeback">I have feedback about the site</label>
+ </div>
+
+ <div class="checkbox-group">
+ <input name="dest" id="dest_from_council" type="radio" value="from_council" class="required"[% IF dest AND dest == 'from_council' %] checked[% END %]>
+ <label class="inline" for="dest_from_council">I am from a council and I have a question for the FixMyStreet team</label>
+ </div>
+
+ <div class="checkbox-group">
+ <input name="dest" id="dest_council" type="radio" value="council" class="required"[% IF dest AND dest == 'council' %] checked[% END %]>
+ <label class="inline" for="dest_council">I want to report a street problem</label>
+ </div>
+
+ <div class="checkbox-group">
+ <input name="dest" id="dest_update" type="radio" value="update"[% IF dest AND dest == 'update' %] checked[% END %]>
+ <label class="inline" for="dest_update">My street problem hasn't been fixed</label>
+ </div>
+[% END %]
diff --git a/templates/web/fixmystreet/footer.html b/templates/web/fixmystreet/footer.html
index dbf9235e0..cb39416f4 100644
--- a/templates/web/fixmystreet/footer.html
+++ b/templates/web/fixmystreet/footer.html
@@ -2,14 +2,16 @@
<footer role="content-info">
<div class="tablewrapper bordered">
<div id="footer-mobileapps">
- <h4>Mobile apps</h4>
- <p>
- <a href="https://itunes.apple.com/gb/app/fixmystreet/id297456545">iPhone</a>
- and
- <a href="https://play.google.com/store/apps/details?id=org.mysociety.FixMyStreet">Android</a>
- apps now available.
- </p>
- </div>
+ <h4>The FixMyStreet App</h4>
+ <p>
+ <a href="https://itunes.apple.com/gb/app/fixmystreet/id297456545">
+ <img alt="FixMyStreet app on the App Store" src="/cobrands/fixmystreet/images/itunes_store_logo.png" />
+ </a>
+ <a href="https://play.google.com/store/apps/details?id=org.mysociety.FixMyStreet">
+ <img alt="FixMyStreet Android app on Google Play" src="/cobrands/fixmystreet/images/google_play_logo.png" />
+ </a>
+ </p>
+ </div>
<div id="footer-help">
<ul>
diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html
index 2c65ca104..b75ef92bc 100644
--- a/templates/web/fixmystreet/report/display.html
+++ b/templates/web/fixmystreet/report/display.html
@@ -23,7 +23,6 @@
[% INCLUDE 'report/banner.html' %]
[% INCLUDE 'report/_main.html' %]
-[% INCLUDE 'report/extra_analytics.html' %]
[% TRY %][% INCLUDE 'report/_message_manager.html' %][% CATCH file %][% END %]
<div class="shadow-wrap">
diff --git a/templates/web/fixmystreet/report/extra_analytics.html b/templates/web/fixmystreet/report/extra_analytics.html
deleted file mode 100644
index 4a993cc2d..000000000
--- a/templates/web/fixmystreet/report/extra_analytics.html
+++ /dev/null
@@ -1,8 +0,0 @@
-[% IF c.flash.created_report %]
-<script type="text/javascript">
- var cobrand = $('meta[name="cobrand"]').attr('content');
- if ( typeof ga !== 'undefined' && cobrand == 'fixmystreet' ) {
- ga('send', 'event', 'report', 'completed', '[% c.flash.created_report %]' );
- }
-</script>
-[% END %]
diff --git a/templates/web/fixmystreet/tracking_code.html b/templates/web/fixmystreet/tracking_code.html
index a9412d4f2..9d8c00d3c 100644
--- a/templates/web/fixmystreet/tracking_code.html
+++ b/templates/web/fixmystreet/tracking_code.html
@@ -7,6 +7,18 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
ga('create', 'UA-660910-4', {'cookieDomain': '.fixmystreet.com'});
ga('set', 'anonymizeIp', true);
+[% IF created_report %]
+ga(function(tracker) {
+ var page = tracker.get('location');
+ var extra = '';
+ if ( page.indexOf('?') != -1 ) {
+ extra = '&created_report=1';
+ } else {
+ extra = '?created_report=1';
+ }
+ tracker.set('location', page + extra);
+});
+[% END %]
ga('send', 'pageview');
</script>
diff --git a/templates/web/southampton/header.html b/templates/web/southampton/header.html
index 113803492..54f8ee2a8 100644
--- a/templates/web/southampton/header.html
+++ b/templates/web/southampton/header.html
@@ -111,7 +111,7 @@
<li><a href="/reports/Southampton">All reports</a></li>
<li><a href="/alerts">Local alerts</a></li>
<li><a href="/faq">Help</a></li>
- <li><a href="/contact">Contact</a></li>
+ <li><a href="http://www.southampton.gov.uk/customer-service/contact/">Contact</a></li>
</ul>
</div>
diff --git a/web/cobrands/fixmystreet/images/google_play_logo.png b/web/cobrands/fixmystreet/images/google_play_logo.png
new file mode 100644
index 000000000..9891cbbd3
--- /dev/null
+++ b/web/cobrands/fixmystreet/images/google_play_logo.png
Binary files differ
diff --git a/web/cobrands/fixmystreet/images/itunes_store_logo.png b/web/cobrands/fixmystreet/images/itunes_store_logo.png
new file mode 100644
index 000000000..b37f4c230
--- /dev/null
+++ b/web/cobrands/fixmystreet/images/itunes_store_logo.png
Binary files differ