diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-02-20 11:24:32 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-02-20 11:24:32 +0000 |
commit | 834d18012ab64e340d06f539fee17d34e0cf7675 (patch) | |
tree | 6478756405efd2a2c04b3bc9d490d396c9112d0f | |
parent | 7b227dea1532f3e68c369d8447611349e8cb44b6 (diff) | |
parent | 25d518e794b7d95525edaa9357adec48a4172c24 (diff) |
Merge branch '972-completion-adverts'
50 files changed, 352 insertions, 629 deletions
diff --git a/conf/general.yml-example b/conf/general.yml-example index 26e12c322..37e81ad5b 100644 --- a/conf/general.yml-example +++ b/conf/general.yml-example @@ -190,6 +190,3 @@ KASABI_API_KEY: '' LONDON_REPORTIT_URL: '' LONDON_REPORTIT_KEY: '' LONDON_REPORTIT_SECRET: '' -AUTH_SHARED_SECRET: '' -HEARFROMYOURMP_BASE_URL: '' - diff --git a/notes/no-update-server b/notes/no-update-server index da3656829..74836bcbf 100644 --- a/notes/no-update-server +++ b/notes/no-update-server @@ -333,9 +333,6 @@ GAZE_URL: 'http://gaze.mysociety.org/gaze' # empty = use /usr/sbin/sendmail' SMTP_SMARTHOST: '' -AUTH_SHARED_SECRET: '' -HEARFROMYOURMP_BASE_URL: '' - ANDROID_URL: 'http://wiki.nuug.no/grupper/fiksgatami/android' ALLOWED_COBRANDS: 'fiksgatami' diff --git a/perllib/CrossSell.pm b/perllib/CrossSell.pm deleted file mode 100644 index 9567c2b38..000000000 --- a/perllib/CrossSell.pm +++ /dev/null @@ -1,297 +0,0 @@ -# CrossSell.pm: -# Adverts from FixMyStreet to another site. -# -# Unlike the PHP crosssell script, returns strings rather than prints them; -# and currently displays the same advert if e.g. there's a connection problem. -# -# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: CrossSell.pm,v 1.17 2009-09-10 09:36:42 matthew Exp $ - -# Config parameters site needs set to call these functions: -# OPTION_AUTH_SHARED_SECRET -# OPTION_HEARFROMYOURMP_BASE_URL - -package CrossSell; - -use strict; -use LWP::Simple qw($ua get); -use URI::Escape; -use mySociety::AuthToken; -use mySociety::Web qw(ent); - -sub display_random_hfymp_advert { - my ($email, $name, $text) = @_; - $name ||= ''; - my $auth_signature = mySociety::AuthToken::sign_with_shared_secret($email, mySociety::Config::get('AUTH_SHARED_SECRET')); - - # See if already signed up - my $url = mySociety::Config::get('HEARFROMYOURMP_BASE_URL'); - my $already_signed = get($url . '/authed?email=' . uri_escape($email) . "&sign=" . uri_escape($auth_signature)); - # Different from PHP version; display this advert if e.g. connection problem - return '' if $already_signed && $already_signed eq 'already signed'; - - $email = ent($email); - $name = ent($name); - $auth_signature = ent($auth_signature); - $text =~ s#\[form\]#<form action="http://www.hearfromyourmp.com/" method="post"> -<input type="hidden" name="name" value="$name"> -<input type="hidden" name="email" value="$email"> -<input type="hidden" name="sign" value="$auth_signature"> -<h2><input style="font-size:100%" type="submit" value="#; - $text =~ s#\[/form\]#"></h2>#; - - return '<div id="advert_hfymp">' . $text . '</div>'; -} - -sub display_random_gny_advert { - my ($email, $name, $text) = @_; - return '<div id="advert_thin">' . $text . '</div>'; -} - -sub display_random_twfy_alerts_advert { - my ($email, $name, $text) = @_; - my $auth_signature = mySociety::AuthToken::sign_with_shared_secret($email, mySociety::Config::get('AUTH_SHARED_SECRET')); - $text =~ s#\[button\]#<form action="http://www.theyworkforyou.com/alert/" method="post"> -<input type="hidden" name="email" value="$email"> -<input type="hidden" name="sign" value="$auth_signature"> -<input type="hidden" name="site" value="fms"> -<input style="font-size:150%" type="submit" value="#; - $text =~ s#\[/button\]#"></p>#; - return '<div id="advert_thin">' . $text . '</div>'; -} - -sub display_hfyc_cheltenham_advert { - my ($email, $name) = @_; - $name ||= ''; - my $auth_signature = mySociety::AuthToken::sign_with_shared_secret($email, mySociety::Config::get('AUTH_SHARED_SECRET')); - - # See if already signed up - my $already_signed = get('http://cheltenham.hearfromyourcouncillor.com/authed?email=' . uri_escape($email) . "&sign=" . uri_escape($auth_signature)); - # Different from PHP version; display this advert if e.g. connection problem - return '' if $already_signed && $already_signed eq 'already signed'; - - # If not, display advert - $email = ent($email); - $name = ent($name); - $auth_signature = ent($auth_signature); - my $out = <<EOF; -<form action="http://cheltenham.hearfromyourcouncillor.com/" method="post"> -<input type="hidden" name="name" value="$name"> -<input type="hidden" name="email" value="$email"> -<input type="hidden" name="sign" value="$auth_signature"> -<div id="advert_thin"> -EOF - - my $rand = int(rand(2)); - if ($rand == 0) { - $out .= "<h2>Cool! You're interested in Cheltenham!</h2> - <p>We've got an exciting new free service that works exclusively - for people in Cheltenham. Please sign up to help the charity - that runs WriteToThem, and to get a sneak preview of our new - service.</p>"; - } else { - $out .= "<h2>Get to know your councillors.</h2> - <p>Local councillors are really important, but hardly anyone knows them. - Use our new free service to build a low-effort, long term relationship - with your councillor.</p>"; - } - $out .= <<EOF; -<p align="center"> -<input type="submit" value="Sign up to HearFromYourCouncillor"> -</p> -</div> -</form> -EOF - return ($out, "cheltenhamhfyc$rand"); -} - -sub display_democracyclub { - my (%input) = @_; - return <<EOF; -<div id="advert_thin"> -<h2 style="margin-bottom:0">Help make the next election the most accountable ever</h2> <p style="font-size:120%;margin-top:0.5em;"><a href="http://www.democracyclub.org.uk/">Join Democracy Club</a> and have fun keeping an eye on your election candidates. <a href="http://www.democracyclub.org.uk/">Sign me up</a>! -</div> -EOF -} - -sub display_news_form { - my (%input) = @_; - my %input_h = map { $_ => $input{$_} ? ent($input{$_}) : '' } qw(name email signed_email); - my $auth_signature = $input_h{signed_email}; - return <<EOF; -<h1 style="padding-top:0.5em">mySociety newsletter</h1> - -<p>Interested in hearing more about FixMyStreet successes? Enter your email -address below and we’ll send you occasional emails about what mySociety -and our users have been up to.</p> - -<form method="post" action="//mysociety.us9.list-manage.com/subscribe/post?u=53d0d2026dea615ed488a8834&id=287dc28511"> -<label style="position: absolute; left: -5000px;"> -Leave this box empty: <input type="text" name="b_53d0d2026dea615ed488a8834_287dc28511" tabindex="-1" value="" /> -</label> -<label for="name">Name:</label> -<input type="text" name="NAME" id="name" value="$input_h{name}" size="30"> -<br><label for="email">Email:</label> -<input type="text" name="EMAIL" id="email" value="$input_h{email}" size="30"> - <input type="submit" name="subscribe" value="Add me to the list"> -</form> - -<p>mySociety respects your privacy, and we'll never sell or give away your private -details. You can unsubscribe at any time.</p> -EOF -} - -sub display_survey_link { - return <<EOF; -<h1 style="padding-top:0.5em">User Survey</h1> -<p> -We're running a survey to help us understand who uses our sites. If you have 10-15 minutes to spare then we'd be grateful if you could <a href="http://questions.mysociety.org/S/fms/w/" target="_blank">take part</a>. -</p> -EOF -} - -sub display_wtt_link { - return <<EOF; -<h1 style="padding-top:0.5em">WriteToThem</h1> -<p> -Need to write to a politician? Try <a href="https://writetothem.com">WriteToThem</a> - great -for campaigns too. -</p> -EOF -} - -sub display_app_links { - return <<EOF; -<h1>Next time, report your issue quicker.</h1> -<p>Download our awesome app, and make reporting and monitoring issues on the go a breeze.</p> - -<p class="app-links"> -<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> -</p> - -<p class="desktop-advice">Not on your mobile? No problem! Download now, and the app will be ready to use when you next pick up your phone.</p> -EOF -} - -# Not currently used, needs more explanation and testing; perhaps in future. -sub display_gny_groups { - my ($lon, $lat) = @_; - my $groups = get("http://www.groupsnearyou.com/rss.php?q=$lon,$lat&category=1&pointonly=1"); - my $out = ''; - my $count = 0; - while ($groups =~ /<item>\s*<title>New group! (.*?)<\/title>.*?<guid isPermaLink="true">(.*?)<\/guid>.*?<description>(.*?)<\/description>/gs) { - $out .= "<li><a href='$2'>$1</a> $3"; - $count++; - } - return unless $out; - return <<EOF; -<h1 style="padding-top:0.5em">$count local groups</h1> -<ul> -$out -</ul> -EOF -} - -# Choose appropriate advert and display it. -# $this_site is to stop a site advertising itself. -sub display_advert ($$;$%) { - my ($c, $email, $name, %data) = @_; - - return '' unless $c->cobrand->moniker eq 'fixmystreet'; - - $ua->timeout(5); - - #if (defined $data{council} && $data{council} eq '2326') { - # my ($out, $ad) = display_hfyc_cheltenham_advert($email, $name); - # if ($out) { - # $c->stash->{scratch} = "advert=$ad"; - # return $out; - # } - #} - - #if ($data{lat}) { - # my $out = display_gny_groups($data{lon}, $data{lat}); - # if ($out) { - # $c->stash->{scratch} = 'advert=gnygroups'; - # return '<div style="margin: 0 5em; border-top: dotted 1px #666666;">' - # . $out . '</div>'; - # } - #} - - #$c->stash->{scratch} = 'advert=demclub0'; - #return display_democracyclub(); - -# return <<EOF; -#<div id="advert_thin"> -#<p>Do you have an issue that’s too big for FixMyStreet? -#It could be time to petition your council. Try our new site: -#<h2 style="margin-top:0; font-size: 150%"> -#<a href="http://www.petitionyourcouncil.com/">PetitionYourCouncil</a></p> -#</h2> -#</div> -#EOF - - #unless (defined $data{done_tms} && $data{done_tms}==1) { - $c->stash->{scratch} = 'advert=wtt'; - return '<div class="advert-mobile-apps">' - . display_app_links() - . '</div>'; - - $c->stash->{scratch} = 'advert=news'; - my $auth_signature = ''; - unless (defined $data{emailunvalidated} && $data{emailunvalidated}==1) { - $auth_signature = mySociety::AuthToken::sign_with_shared_secret($email, mySociety::Config::get('AUTH_SHARED_SECRET')); - } - return '<div style="margin: 0 5em; border-top: dotted 1px #666666;">' - . display_news_form(email => $email, name => $name, signed_email => $auth_signature) - . '</div>'; - #} - - my @adverts = ( - [ 'gny0', '<h2>Are you a member of a local group…</h2> …which uses the internet to coordinate itself, such as a neighbourhood watch? If so, please help the charity that runs FixMyStreet by <a href="http://www.groupsnearyou.com/add/about/">adding some information about it</a> to our new site, GroupsNearYou.' ], - [ 'gny1', '<h2>Help us build a map of the world’s local communities –<br><a href="http://www.groupsnearyou.com/add/about/">Add one to GroupsNearYou</a></h2>' ], - # Since you're interested in your local area, why not - # start a long term relationship with your MP? - #[ 'hfymp0', '<h2 style="margin-bottom:0">Get email from your MP in the future</h2> <p style="font-size:120%;margin-top:0;">and have a chance to discuss what they say in a public forum [form]Sign up to HearFromYourMP[/form]' ], - #[ 'twfy_alerts0', '<h2>Get emailed every time your MP says something in Parliament</h2> [button]Keep an eye on them for free![/button]' ], - ); - while (@adverts) { - my $rand = int(rand(scalar @adverts)); - next unless $adverts[$rand]; - my ($advert_id, $advert_text) = @{$adverts[$rand]}; - (my $advert_site = $advert_id) =~ s/\d+$//; - my $func = "display_random_${advert_site}_advert"; - no strict 'refs'; - my $out = &$func($email, $name, $advert_text); - use strict 'refs'; - if ($out) { - $c->stash->{scratch} = "advert=$advert_id"; - return $out; - } - - for (my $i=0; $i<@adverts; $i++) { - (my $a = $adverts[$i][0]) =~ s/\d+$//; - delete $adverts[$i] if $advert_site eq $a; - } - } - - $c->stash->{scratch} = 'advert=pb'; - return <<EOF; -<div id="advert_thin"> -<h2 style="font-size: 150%"> -If you're interested in improving your local area, -<a href="http://www.pledgebank.com/">use PledgeBank</a> to -do so with other people!</h2> -</div> -EOF -} - -1; diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index f48518d77..222c0c242 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -41,6 +41,11 @@ Handle contact us form submission sub submit : Path('submit') : Args(0) { my ( $self, $c ) = @_; + if (my $testing = $c->req->params->{_test_}) { + $c->stash->{success} = $c->req->params->{success}; + return; + } + $c->res->redirect( '/contact' ) and return unless $c->req->method eq 'POST'; return diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 70edcabe3..f6cc33e74 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -67,9 +67,16 @@ token), or the mini own-report one (when we'll have a problem ID). sub submit : Path('submit') { my ( $self, $c ) = @_; - if ( $c->req->params->{token} ) { + if (my $token = $c->req->params->{token}) { + if ($token eq '_test_') { + $c->stash->{been_fixed} = $c->req->params->{been_fixed}; + $c->stash->{new_state} = $c->req->params->{new_state}; + $c->stash->{template} = 'questionnaire/completed.html'; + return; + } $c->forward('submit_standard'); - } elsif ( $c->req->params->{problem} ) { + } elsif (my $p = $c->req->params->{problem}) { + $c->detach('creator_fixed') if $p eq '_test_'; $c->forward('submit_creator_fixed'); } else { $c->detach( '/page_error_404_not_found' ); @@ -106,6 +113,7 @@ sub submit_creator_fixed : Private { } my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem_id} } ); + $c->stash->{problem} = $problem; # you should not be able to answer questionnaires about problems # that you've not submitted diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index e188a085d..817e2a631 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -168,9 +168,6 @@ 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 ebc5cc6a0..5021d90e0 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1132,23 +1132,10 @@ sub redirect_or_confirm_creation : Private { if ( $report->confirmed ) { # Subscribe problem reporter to email updates $c->forward( 'create_reporter_alert' ); - my $report_uri; - - if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_body && $c->stash->{external_source_id}) { - $report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } ); - } elsif ( $c->cobrand->never_confirm_reports && $report->non_public ) { - $c->log->info( 'cobrand was set to always confirm reports and report was non public, success page showed'); - $c->stash->{template} = 'report_created.html'; - return 1; - } else { - $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); - if ( $c->sessionid ) { - $c->flash->{created_report} = 'loggedin'; - } - $c->res->redirect($report_uri); - $c->detach; + $c->log->info($report->user->id . ' was logged in, showing confirmation page for ' . $report->id); + $c->stash->{created_report} = 'loggedin'; + $c->stash->{template} = 'tokens/confirm_problem.html'; + return 1; } # otherwise create a confirm token and email it to them. diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index b97420238..f1a1aa821 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -376,11 +376,8 @@ sub redirect_or_confirm_creation : Private { if ( $update->confirmed ) { $c->forward( 'update_problem' ); $c->forward( 'signup_for_alerts' ); - - my $report_uri = $c->cobrand->base_url_for_report( $update->problem ) . $update->problem->url; - $c->flash->{comment_created} = 1; - $c->res->redirect($report_uri); - $c->detach; + $c->stash->{template} = 'tokens/confirm_update.html'; + return 1; } # otherwise create a confirm token and email it to them. diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm index 44cb2429d..c8a7531d6 100644 --- a/perllib/FixMyStreet/App/Controller/Tokens.pm +++ b/perllib/FixMyStreet/App/Controller/Tokens.pm @@ -28,6 +28,16 @@ problem but are not logged in. sub confirm_problem : Path('/P') { my ( $self, $c, $token_code ) = @_; + if ($token_code eq '_test_') { + $c->stash->{report} = { + id => 123, + title => 'Title of Report', + bodies_str => 'True', + url => '/report/123', + }; + return; + } + my $auth_token = $c->forward( 'load_auth_token', [ $token_code, 'problem' ] ); @@ -37,7 +47,7 @@ sub confirm_problem : Path('/P') { # Look at all problems, not just cobrand, in case am approving something we don't actually show my $problem = $c->model('DB::Problem')->find( { id => $problem_id } ) || $c->detach('token_error'); - $c->stash->{problem} = $problem; + $c->stash->{report} = $problem; if ( $problem->state eq 'unconfirmed' && $auth_token->created < DateTime->now->subtract( months => 1 ) ) { $c->stash->{template} = 'errors/generic.html'; @@ -83,7 +93,6 @@ sub confirm_problem : Path('/P') { ) if $problem->state eq 'unconfirmed'; # Subscribe problem reporter to email updates - $c->stash->{report} = $c->stash->{problem}; $c->forward( '/report/new/create_reporter_alert' ); # log the problem creation user in to the site @@ -135,6 +144,11 @@ alert but are not logged in. sub confirm_alert : Path('/A') { my ( $self, $c, $token_code ) = @_; + if ($token_code eq '_test_') { + $c->stash->{confirm_type} = $c->req->params->{confirm_type}; + return; + } + my $auth_token = $c->forward( 'load_auth_token', [ $token_code, 'alert' ] ); # Load the problem @@ -170,6 +184,16 @@ update but are not logged in. sub confirm_update : Path('/C') { my ( $self, $c, $token_code ) = @_; + if ($token_code eq '_test_') { + $c->stash->{problem} = { + id => 123, + title => 'Title of Report', + bodies_str => 'True', + url => '/report/123', + }; + return; + } + my $auth_token = $c->forward( 'load_auth_token', [ $token_code, 'comment' ] ); diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 033ad583f..da549ece8 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -7,7 +7,6 @@ use warnings; use mySociety::Locale; use mySociety::Web qw(ent); use FixMyStreet; -use CrossSell; use Utils; __PACKAGE__->config( @@ -18,7 +17,7 @@ __PACKAGE__->config( ENCODING => 'utf8', render_die => 1, expose_methods => [ - 'loc', 'nget', 'tprintf', 'display_crosssell_advert', 'prettify_dt', + 'loc', 'nget', 'tprintf', 'prettify_dt', 'add_links', 'version', 'decode', ], FILTERS => { @@ -79,19 +78,6 @@ sub tprintf { return sprintf $format, @args; } -=head2 display_crosssell_advert - - [% display_crosssell_advert( email, name ) %] - -Displays a crosssell advert (will be fixmystreet cobrand only). - -=cut - -sub display_crosssell_advert { - my ( $self, $c, $email, $name, %data ) = @_; - return CrossSell::display_advert( $c, $email, $name, %data ); -} - =head2 Utils::prettify_dt [% pretty = prettify_dt( $dt, $short_bool ) %] diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 115bb181a..10c4c8ab9 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -132,7 +132,7 @@ foreach my $test ( ok $token->data->{id} == $existing_id, 'subscribed to existing alert'; $mech->get_ok("/A/$url_token"); - $mech->content_contains('successfully confirmed'); + $mech->content_contains('alert created'); $alert = FixMyStreet::App->model('DB::Alert')->find( { id => $existing_id, } ); @@ -370,9 +370,9 @@ subtest "Test normal alert signups and that alerts are sent" => sub { my ( $url, $url_token ) = $email->body =~ m{http://\S+(/A/(\S+))}; my $token = FixMyStreet::App->model('DB::Token')->find( { token => $url_token, scope => 'alert' } ); $mech->get_ok( $url ); - $mech->content_contains('successfully confirmed'); + $mech->content_contains('alert created'); } else { - $mech->content_contains('successfully created'); + $mech->content_contains('alert created'); } } @@ -473,7 +473,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { ($url) = $emails[0]->body =~ m{http://\S+(/A/\S+)}; $mech->get_ok( $url ); - $mech->content_contains('successfully deleted'); + $mech->content_contains('alert deleted'); $mech->delete_user($user1); $mech->delete_user($user2); diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t index 89a1db5b2..cf8a3161b 100644 --- a/t/app/controller/contact.t +++ b/t/app/controller/contact.t @@ -259,7 +259,7 @@ for my $test ( $mech->get_ok('/contact'); } $mech->submit_form_ok( { with_fields => $test->{fields} } ); - $mech->content_contains('Thanks for your feedback'); + $mech->content_contains('Thank you for your feedback'); $mech->email_count_is(1); my $email = $mech->get_email; @@ -385,7 +385,7 @@ for my $test ( $mech->clear_emails_ok; $mech->get_ok('/contact'); $mech->submit_form_ok( { with_fields => $test->{fields} } ); - $mech->content_contains('Thanks for your feedback'); + $mech->content_contains('Thank you for your feedback'); $mech->email_count_is(1); } }; diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index 752dbb4cb..5938acc79 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -252,13 +252,13 @@ foreach my $test ( # Check the right HTML page has been returned $mech->content_like( qr/<title>[^<]*Questionnaire/m ); - $mech->content_contains( 'glad to hear it’s been fixed' ) + $mech->content_contains( 'Glad to hear' ) if $result =~ /fixed/; - $mech->content_lacks( 'glad to hear it’s been fixed' ) + $mech->content_lacks( 'Glad to hear' ) if $result !~ /fixed/; $mech->content_contains( 'get some more information about the status of your problem' ) if $result eq 'unknown'; - $mech->content_contains( "sorry to hear that" ) + $mech->content_contains( "sorry to hear" ) if $result eq 'confirmed' || $result eq 'closed'; # Check the database has the right information @@ -319,7 +319,7 @@ subtest 'Check updates are shown correctly on questionnaire page' => sub { $mech->content_contains( 'This is some update text' ); }; -for my $test ( +for my $test ( { state => 'confirmed', fixed => 0 diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 67e899102..49ff7b69e 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -750,8 +750,7 @@ subtest "test report creation for a user who is signing in as they report" => su 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('Thank you for reporting this issue'); # Check the report has been assigned appropriately is $report->bodies_str, $body_ids{2651}; @@ -852,8 +851,7 @@ foreach my $test ( # Check the report has been assigned appropriately is $report->bodies_str, $body_ids{$test->{council}}; - # check that we got redirected to /report/ - is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; + $mech->content_contains('Thank you for reporting this issue'); # check that no emails have been sent $mech->email_count_is(0); @@ -1227,18 +1225,18 @@ subtest "test Hart" => sub { button => 'submit_register', }, { - desc => 'confirm redirect for cobrand council in two tier cobrand redirects to cobrand site', + desc => 'confirmation page for cobrand council in two tier cobrand links to cobrand site', category => 'Trees', council => 2333, national => 0, - redirect => 1, + confirm => 1, }, { - desc => 'confirm redirect for non cobrand council in two tier cobrand redirect to national site', + desc => 'confirmation page for non cobrand council in two tier cobrand links to national site', category => 'Street Lighting', council => 2227, national => 1, - redirect => 1, + confirm => 1, }, ) { subtest $test->{ desc } => sub { @@ -1247,7 +1245,7 @@ subtest "test Hart" => sub { $mech->clear_emails_ok; $mech->log_out_ok; - my $user = $mech->log_in_ok($test_email) if $test->{redirect}; + my $user = $mech->log_in_ok($test_email) if $test->{confirm}; FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'hart', 'fixmystreet' ], @@ -1258,13 +1256,13 @@ subtest "test Hart" => sub { $mech->content_contains( "Hart Council" ); $mech->submit_form_ok( { with_fields => { pc => 'GU51 4AE' } }, "submit location" ); $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" ); - my %optional_fields = $test->{redirect} ? () : + my %optional_fields = $test->{confirm} ? () : ( email => $test_email, phone => '07903 123 456' ); # we do this as otherwise test::www::mechanize::catalyst # goes to the value set in ->host above irregardless and # that is a 404. It works but it is not pleasant. - $mech->clear_host if $test->{redirect} && $test->{national}; + $mech->clear_host if $test->{confirm} && $test->{national}; $mech->submit_form_ok( { button => $test->{button}, @@ -1295,11 +1293,11 @@ subtest "test Hart" => sub { # Check the report has been assigned appropriately is $report->bodies_str, $body_ids{$test->{council}}; - if ( $test->{redirect} ) { - is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; + if ( $test->{confirm} ) { + is $mech->uri->path, "/report/new"; my $base = 'www.fixmystreet.com'; $base = "hart.fixmystreet.com" unless $test->{national}; - is $mech->uri->host, $base, 'redirected to correct site'; + $mech->content_contains("$base/report/" . $report->id, "links to correct site"); } else { # receive token my $email = $mech->get_email; @@ -1454,12 +1452,8 @@ subtest "test SeeSomething" => sub { ok $report->confirmed, 'Report is confirmed automatically'; - if ( $test->{public} ) { - is $mech->uri->path, '/report/' . $report->id, 'redirects to report page'; - } else { - is $mech->uri->path, '/report/new', 'stays on report/new page'; - $mech->content_contains( 'Your report has been sent', 'use report created template' ); - } + is $mech->uri->path, '/report/new', 'stays on report/new page'; + $mech->content_contains( 'Your report has been sent', 'use report created template' ); $user->alerts->delete; $user->problems->delete; @@ -1537,9 +1531,6 @@ subtest "extra google analytics code displayed on logged in problem creation" => 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( "'id': 'report/" . $report->id . "'", 'extra google code present' ); # cleanup diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 64ed91ac0..58d9eff86 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -457,6 +457,8 @@ for my $test ( }, 'submit update' ); + $mech->content_contains("/report/$report_id"); + $mech->get_ok("/report/$report_id"); $mech->content_contains('Test 2'); $mech->content_contains('Update no email confirm'); @@ -690,6 +692,7 @@ for my $test ( }, 'submit update' ); + $mech->get_ok("/report/$report_id"); $report->discard_changes; my $update = $report->comments->first; @@ -816,6 +819,7 @@ subtest "check comment with no status change has not status in meta" => sub { }, 'submit update' ); + $mech->get_ok("/report/$report_id"); $report->discard_changes; @updates = $report->comments->search(undef, { order_by => 'created' })->all;; @@ -971,7 +975,7 @@ for my $test ( "submit good details" ); - is $mech->uri->path, "/report/" . $report_id, "redirected to report page"; + $mech->content_contains('Thank you for updating this issue'); $mech->email_count_is(0); my $update = $report->comments->first; @@ -1201,7 +1205,9 @@ for my $test ( 'submit update' ); - is $mech->uri->path, "/report/" . $report_id, "redirected to report page"; + $mech->content_contains('Thank you for updating this issue'); + $mech->content_contains("/report/" . $report_id); + $mech->get_ok("/report/" . $report_id); if ( !defined( $test->{endstate_banner} ) ) { is $mech->extract_problem_banner->{text}, undef, 'endstate banner'; @@ -1255,7 +1261,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 0, - path => '/report/update', content => "Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?", }, @@ -1282,7 +1287,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 0, - path => '/report/update', content => "Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?", }, @@ -1310,7 +1314,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 1, - path => '/report/' . $report->id, content => $report->title, }, ) @@ -1363,7 +1366,7 @@ foreach my $test ( $mech->submit_form_ok( { with_fields => $test->{fields}, }, 'submit update' ); - is $mech->uri->path, $test->{path}, "page after submission"; + is $mech->uri->path, '/report/update', "page after submission"; $mech->content_contains( $test->{content} ); @@ -1393,7 +1396,8 @@ foreach my $test ( $mech->submit_form_ok( { with_fields => { reported => 'Yes' } } ); - $mech->content_contains( 'Thank you — you can' ); + $mech->content_contains( $report->title ); + $mech->content_contains( 'Thank you for updating this issue' ); $questionnaire = FixMyStreet::App->model( 'DB::Questionnaire' )->find( { problem_id => $report_id } @@ -1452,7 +1456,7 @@ for my $test ( anonymous => 0, answered => 1, path => '/report/update', - content => "You have successfully confirmed your update", + content => "Thank you for updating this issue", }, ) { @@ -1542,7 +1546,8 @@ for my $test ( $mech->submit_form_ok( { with_fields => { reported => 'Yes' } } ); - $mech->content_contains( 'Thank you — you can' ); + $mech->content_contains( $report->title ); + $mech->content_contains( 'Thank you for updating this issue' ); $questionnaire = FixMyStreet::App->model( 'DB::Questionnaire' )->find( { problem_id => $report_id } diff --git a/templates/web/base/auth/sign_out.html b/templates/web/base/auth/sign_out.html index 571e13f9f..c95efacf5 100644 --- a/templates/web/base/auth/sign_out.html +++ b/templates/web/base/auth/sign_out.html @@ -1,7 +1,10 @@ [% INCLUDE 'header.html', title = loc('Sign out'), bodyclass = 'fullwidthpage' %] -<h1>[% loc('You have been signed out') %]</h1> +<div class="confirmation-header"> + <h1>[% loc('You have been signed out') %]</h1> + <p>[% tprintf( loc('Please feel free to <a href="%s">sign in again</a>, or go back to the <a href="/">front page</a>.'), c.uri_for('/auth') ) %]</p> +</div> -<p>[% tprintf( loc('Please feel free to <a href="%s">sign in again</a>, or go back to the <a href="/">front page</a>.'), c.uri_for('/auth') ) %]</p> +[% INCLUDE next_steps.html %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/contact/submit.html b/templates/web/base/contact/submit.html index fc416c2d7..5adb87e2d 100644 --- a/templates/web/base/contact/submit.html +++ b/templates/web/base/contact/submit.html @@ -1,20 +1,21 @@ -[% INCLUDE 'header.html', title = loc('Contact Us'), bodyclass = 'fullwidthpage' %] +[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Contact Us') %] -<h1>[% loc('Contact the team') %]</h1> - [% IF success %] - <p> - [% loc("Thanks for your feedback. We'll get back to you as soon as we can!") %] - </p> - [% display_crosssell_advert( em, form_name, 'emailunvalidated', 1 ) %] + <div class="confirmation-header"> + <h1>[% loc('Thank you for your feedback') %]</h1> + <p>[% loc('We’ll get back to you as soon as we can.') %]</p> + </div> [% ELSE %] - <p> - [% tprintf( loc('Failed to send message. Please try again, or <a href="mailto:%s">email us</a>.'), contact_email ) %] - </p> + <div class="confirmation-header confirmation-header--failure"> + <h1>[% loc('Failed to send message') %]</h1> + <p>[% loc('Try emailing us directly:') %] <a href="mailto:[% contact_email %]">[% contact_email %]</a></p> + </div> [% END %] +[% INCLUDE next_steps.html %] + [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/next_steps.html b/templates/web/base/next_steps.html new file mode 100644 index 000000000..9d5b22c80 --- /dev/null +++ b/templates/web/base/next_steps.html @@ -0,0 +1,5 @@ +[%# +Override this file in your cobrand to show promotions or suggested next steps +to your users after they perform major interactions like confirming or updating +problem reports, setting up local area alerts, or signing out. +%] diff --git a/templates/web/base/questionnaire/completed-open.html b/templates/web/base/questionnaire/completed-open.html index c860b7341..0be40ac86 100644 --- a/templates/web/base/questionnaire/completed-open.html +++ b/templates/web/base/questionnaire/completed-open.html @@ -1,11 +1,3 @@ -[% IF c.cobrand.is_council %] -<p style="font-size: 150%"> -Thank you very much for filling in our questionnaire. -</p> -[% ELSE %] -[% loc('<p style="font-size:150%">We’re sorry to hear that. We have two -suggestions: why not try writing to your local representatives or, if -it’s a problem that could be fixed by local people working together, why -not <a href="http://www.pledgebank.com/new">make and publicise a pledge</a>? -</p>') %] +[% IF ! c.cobrand.is_council %] + <p>[% loc('We’re sorry to hear the problem’s not fixed. Why not try writing to your local representatives?') %]</p> [% END %] diff --git a/templates/web/base/questionnaire/completed.html b/templates/web/base/questionnaire/completed.html index 4d848a63c..32aa8bd68 100644 --- a/templates/web/base/questionnaire/completed.html +++ b/templates/web/base/questionnaire/completed.html @@ -1,28 +1,21 @@ -[% - INCLUDE 'header.html', title = loc('Questionnaire') -%] +[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Questionnaire') %] -[% advert_outcome = 1 %] +<div class="confirmation-header"> -[% IF been_fixed == 'Unknown' %] + <h1>[% loc('Thank you for your feedback') %]</h1> -[% loc('<p>Thank you very much for filling in our questionnaire; if you -get some more information about the status of your problem, please come back to the -site and leave an update.</p>') %] + [% IF been_fixed == 'Unknown' %] + <p>[% loc('If you get some more information about the status of your problem, please come back to the site and leave an update.') %]</p> -[% ELSIF new_state == 'confirmed' OR (!new_state AND problem.is_open) OR (!new_state AND problem.is_closed) %] + [% ELSIF new_state == 'confirmed' OR (!new_state AND problem.is_open) OR (!new_state AND problem.is_closed) %] + [% INCLUDE 'questionnaire/completed-open.html' %] -[% INCLUDE 'questionnaire/completed-open.html' %] -[% advert_outcome = 0 %] + [% ELSIF been_fixed == 'Yes' %] + <p>[% loc('Glad to hear it’s been fixed!') %]</p> -[% ELSIF been_fixed == 'Yes' %] + [% END %] -[% loc('<p style="font-size:150%">Thank you very much for filling in our questionnaire; glad to hear it’s been fixed.</p>') %] - -[% END %] - -[% IF advert_outcome %] - [% display_crosssell_advert( problem.user.email, problem.name, 'council', problem.bodies_str ) %] -[% END %] +</div> +[% INCLUDE next_steps.html %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/report/new/category_extras.html b/templates/web/base/report/new/category_extras.html index 6b15cbef9..41984dd9a 100644 --- a/templates/web/base/report/new/category_extras.html +++ b/templates/web/base/report/new/category_extras.html @@ -5,24 +5,21 @@ [%- FOR meta IN category_extras.$category %] [%- meta_name = meta.code -%] -[% IF field_errors.$meta_name %] - <div class='form-error'>[% field_errors.$meta_name %]</div> -[% END -%] - - <div class="form-field"> - <label for="form_[% meta_name %]">[% meta.description _ ':' %]</label> - [% IF meta.variable != 'false' %] - [% IF meta.exists('values') - <select name="[% meta_name %]" id="form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> - [% FOR option IN meta.values.value.value %] - <option value="[% option.key.0 %]"[% IF option.key.0 == report_meta.$meta_name.value %] selected[% END %]>[% option.name.0 %]</option> + <label for="form_[% meta_name %]">[% meta.description _ ':' %]</label> + [% IF field_errors.$meta_name %] + <p class='form-error'>[% field_errors.$meta_name %]</p> + [% END -%] + [% IF meta.variable != 'false' %] + [% IF meta.exists('values') %] + <select name="[% meta_name %]" id="form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> + [% FOR option IN meta.values.value %] + <option value="[% option.key.0 %]"[% IF option.key.0 == report_meta.$meta_name.value %] selected[% END %]>[% option.name.0 %]</option> + [% END %] + </select> + [% ELSE %] + <input type="text" value="[% report_meta.$meta_name.value | html %]" name="[% meta_name %]" id="form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> [% END %] - </select> - [% ELSE %] - <input type="text" value="[% report_meta.$meta_name | html %]" name="[% meta_name %]" id="form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> [% END %] - [% END %] - </div> [%- END %] [%- END %] </div> diff --git a/templates/web/base/report_created.html b/templates/web/base/report_created.html deleted file mode 100644 index 81083654b..000000000 --- a/templates/web/base/report_created.html +++ /dev/null @@ -1,9 +0,0 @@ -[% INCLUDE 'header.html', title => loc('Report created') %] - -<h1>[% loc("Report created") %]</h1> - -<p> -[% loc('Your report has been created and will shortly be sent.') %] -</p> - -[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/tokens/confirm_alert.html b/templates/web/base/tokens/confirm_alert.html index a33f7e92a..f0ad12ff8 100644 --- a/templates/web/base/tokens/confirm_alert.html +++ b/templates/web/base/tokens/confirm_alert.html @@ -1,20 +1,19 @@ [% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title => loc('Local RSS feeds and email alerts') %] <div class="confirmation-header"> - <h1>[% loc('Local RSS feeds and email alerts') %]</h1> -<p> -[% IF confirm_type == 'subscribe' %] - [% loc('You have successfully confirmed your alert.') %] -[% ELSIF confirm_type == 'unsubscribe' %] - [% loc('You have successfully deleted your alert.') %] -[% ELSIF confirm_type == 'created' %] - [% loc('You have successfully created your alert.') %] -[% END %] -</p> + [% IF confirm_type == 'subscribe' || confirm_type == 'created' %] + <h1>[% loc('Email alert created') %]</h1> + <p>[% loc('Why stop there? <a href="/alert">Set up more alerts</a> for free.') %]</p> + + [% ELSIF confirm_type == 'unsubscribe' %] + <h1>[% loc('Email alert deleted') %]</h1> + <p>[% loc('Inbox zero, here we come!') %]</p> + + [% END %] </div> -[% display_crosssell_advert( alert.user.email, alert.user.name ) %] +[% INCLUDE next_steps.html %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/tokens/confirm_problem.html b/templates/web/base/tokens/confirm_problem.html index 8c92c874a..5892d0f9e 100644 --- a/templates/web/base/tokens/confirm_problem.html +++ b/templates/web/base/tokens/confirm_problem.html @@ -1,40 +1,30 @@ [% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Confirmation') %] <div class="confirmation-header"> - <h1>[% loc('Your problem has been confirmed!') %]</h1> -[% IF c.cobrand.is_council %] + <h1><a href="[% c.cobrand.base_url_for_report( report ) %][% report.url %]">[% report.title %]</a></h1> - <p> - Thank you. You have successfully confirmed your report - and this will now be investigated by the council. - You can <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]">view the problem on this site</a>. - </p> - <p>Your reference for this problem is [% problem.id %], please quote it in any enquiries.</p> + [% IF c.cobrand.is_council %] + <h2>Your issue is on its way to the council.</h2> + <p>Your reference for this report is [% report.id %], please quote it in any enquiries.</p> -[% ELSE %] + [% ELSE %] + <h2>[% loc('Thank you for reporting this issue!') %]</h2> + [% IF report.bodies_str %] + <p>[% loc('It’s on its way to the council right now.') %]</p> + [% END %] - <p> - [% loc('Thank you for reporting this issue') %]. - [% IF problem.bodies_str; - loc('<strong>We will now send it to the council</strong>.'); - END; %] - </p> - - <p> - [% tprintf( - loc( 'You can <a href="%s%s">view the problem on this site</a>.' ), - c.cobrand.base_url_for_report( problem ), - problem.url - ); %] - </p> - -[% END %] + [% END %] [% TRY %][% INCLUDE 'tokens/_extras_confirm.html' %][% CATCH file %][% END %] </div> -[% display_crosssell_advert( problem.user.email, problem.name ) %] +[% INCLUDE + next_steps.html, + just_interacted = 1, + share_url = c.cobrand.base_url_for_report(report) _ report.url, + twitter_comment = loc('I just reported a problem on @fixmystreet') +%] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/tokens/confirm_update.html b/templates/web/base/tokens/confirm_update.html index 21fcfc4ff..01ac992ab 100644 --- a/templates/web/base/tokens/confirm_update.html +++ b/templates/web/base/tokens/confirm_update.html @@ -1,24 +1,26 @@ -[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title => loc('Confirmation') %] +[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Confirmation'); -<div class="confirmation-header"> - <h1>[% loc('Your update has been confirmed!') %]</h1> +DEFAULT problem = update.problem; +SET problem_url = c.uri_for('/report', problem.id); +IF update; + problem_url = problem_url _ '#update_' _ update.id; +END; -<p class="confirmed"> -[% IF creator_fixed %] -[% - tprintf(loc('Thank you — you can <a href="%s">view your updated problem</a> on the site.'), - c.uri_for( '/report', problem_id ) ); -%] -[% ELSE %] -[% - tprintf( loc('You have successfully confirmed your update and you can now <a href="%s">view it on the site</a>.'), - c.uri_for( '/report', update.problem.id ) _ '#update_' _ update.id ); %] -[% END %] -</p> + +<div class="confirmation-header"> + + <h1><a href="[% problem_url %]">[% problem.title %]</a></h1> + + <h2>[% loc('Thank you for updating this issue!') %]</h2> </div> -[% display_crosssell_advert( update.user.email, update.name ) %] +[% INCLUDE + next_steps.html, + just_interacted = 1, + share_url = c.cobrand.base_url_for_report(problem) _ problem.url, + twitter_comment = loc('I just updated a problem on @fixmystreet') +%] [% INCLUDE 'footer.html' %] diff --git a/templates/web/emptyhomes/tokens/confirm_problem.html b/templates/web/emptyhomes/tokens/confirm_problem.html index 5e77ca59f..a8a025058 100644 --- a/templates/web/emptyhomes/tokens/confirm_problem.html +++ b/templates/web/emptyhomes/tokens/confirm_problem.html @@ -2,7 +2,7 @@ <h1>[% loc('Confirmation') %]</h1> -[% IF problem.bodies_str %] +[% IF report.bodies_str %] <p>[% loc( 'Thank you for reporting an empty property on ReportEmptyHomes.com. We have emailed the lead officer for empty homes in the council responsible with details, and asked them to do whatever they can to get the empty property back into use as soon as possible.' @@ -36,7 +36,7 @@ as possible will be covered.') [% END %] <p> - <a href="[% c.uri_for( '/report', problem.id ) | html %]">[% loc('View your report') %]</a>. + <a href="[% c.uri_for( '/report', report.id ) | html %]">[% loc('View your report') %]</a>. </p> [% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmystreet.com/next_steps.html b/templates/web/fixmystreet.com/next_steps.html new file mode 100644 index 000000000..1c286827d --- /dev/null +++ b/templates/web/fixmystreet.com/next_steps.html @@ -0,0 +1,42 @@ +[%# A trio of suggested steps, shown on completion pages across FMS.com %] + +[% DEFAULT share_url = c.cobrand.base_url %] +[% DEFAULT twitter_comment = 'I just used @fixmystreet, you should try it!' %] + +<div class="next-steps"> + <div class="next-steps__step next-steps__step--apps"> + [% IF just_interacted %] + <h2>[% loc('Next time, try our mobile app!') %]</h2> + [% ELSE %] + <h2>[% loc('Have you tried our mobile app?') %]</h2> + [% END %] + <p>[% loc('Download it now, and it’ll be ready to use when you next pick up your phone.') %]</p> + <p class="next-steps__step__cta"> + <a href="https://itunes.apple.com/gb/app/fixmystreet/id297456545"><img src="/cobrands/fixmystreet/images/next-step-apple.png" alt="Download on the App Store" width="120" height="37"></a> + <a href="https://play.google.com/store/apps/details?id=org.mysociety.FixMyStreet"><img src="/cobrands/fixmystreet/images/next-step-google.png" alt="Android app on Google Play" width="120" height="37"></a> + </p> + </div> + <div class="next-steps__step next-steps__step--social"> + [% IF just_interacted %] + <h2>[% loc('Great work. Now spread the word!') %]</h2> + <p>[% loc('Share your report on Twitter and Facebook, and let your friends join the conversation.') %]</p> + [% ELSE %] + <h2>[% loc('Spread the word about FixMyStreet!') %]</h2> + <p>[% loc('You know how to get things fixed - now make sure your friends do too.') %]</p> + [% END %] + <p class="next-steps__step__cta"> + <a href="https://twitter.com/intent/tweet?text=[% twitter_comment | uri %]&url=[% share_url | uri %]&related=fixmystreet,mysociety"><img src="/cobrands/fixmystreet/images/next-step-twitter.png" alt="Tweet it" width="120" height="37"></a> + <a href="https://www.facebook.com/sharer/sharer.php?u=[% share_url | uri %]"><img src="/cobrands/fixmystreet/images/next-step-facebook.png" alt="Share on Facebook" width="120" height="37"></a> + </p> + </div> + <div class="next-steps__step next-steps__step--goodies"> + <h2>[% loc('Free FixMyStreet goodies for you!') %]</h2> + <a href="/posters"> + <img src="/cobrands/fixmystreet/images/next-step-goodies.png" alt="" width="105" height="125" class="goodies-preview"> + </a> + <p>[% loc('Perfect for civic groups, clubs, and schools.') %]</p> + <p class="next-steps__step__cta"> + <a href="/posters"><img src="/cobrands/fixmystreet/images/next-step-download.png" alt="Download" width="120" height="37"></a> + </p> + </div> +</div> diff --git a/templates/web/fixmystreet.com/questionnaire/completed-open.html b/templates/web/fixmystreet.com/questionnaire/completed-open.html index df8e2d271..073fb0438 100644 --- a/templates/web/fixmystreet.com/questionnaire/completed-open.html +++ b/templates/web/fixmystreet.com/questionnaire/completed-open.html @@ -1,23 +1,19 @@ -[% IF c.cobrand.is_council %] - <p style="font-size: 150%"> - Thank you very much for filling in our questionnaire. - </p> -[% ELSE %] - <p style="font-size:150%">We’re sorry to hear that your problem hasn't been fixed.</p> +[% IF ! c.cobrand.is_council %] + <h2>We’re sorry to hear that your problem hasn’t been fixed.</h2> <p> - FixMyStreet helps you send a report to your council, but we're not responsible for fixing things. - If you'd like to chase your issue, please search your inbox for the latest reply, or auto-reply + FixMyStreet helps you send a report to your council, but we’re not responsible for fixing things. + If you’d like to chase your issue, please search your inbox for the latest reply, or auto-reply from your council, and respond to that. </p> <p> - Meanwhile, if you're getting nowhere, you might consider writing to your local councillor or other + Meanwhile, if you’re getting nowhere, you might consider writing to your local councillor or other representative to see if they can help. </p> <p> - You can do this on <a href="https://www.writetothem.com/">https://www.writetothem.com/</a>, another + You can do this on <a href="https://www.writetothem.com/">WriteToThem</a>, another useful mySociety website. </p> [% END %] diff --git a/templates/web/fixmystreet.com/report/_extras_top.html b/templates/web/fixmystreet.com/report/_extras_top.html deleted file mode 100755 index 4938e8749..000000000 --- a/templates/web/fixmystreet.com/report/_extras_top.html +++ /dev/null @@ -1,3 +0,0 @@ -[% IF created_report %] - [% INCLUDE 'research/survey_link.html' %] -[% END %] diff --git a/templates/web/fixmystreet.com/tracking_code.html b/templates/web/fixmystreet.com/tracking_code.html index 23bd8d992..3b163f516 100644 --- a/templates/web/fixmystreet.com/tracking_code.html +++ b/templates/web/fixmystreet.com/tracking_code.html @@ -20,7 +20,7 @@ ga(function(tracker) { tracker.set('location', page + extra); }); ga('ecommerce:addItem', { - 'id': 'report/[% problem.id %]', + 'id': 'report/[% report.id %]', 'quantity': '1', 'name': 'Report' }); diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index 314b09b28..91762e022 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -17,8 +17,6 @@ <p class='form-success'>[% loc('You have successfully signed in; please check and confirm your details are accurate:') %]</p> [% END %] -[% TRY %][% INCLUDE 'report/_extras_top.html' %][% CATCH file %][% END %] - [% INCLUDE 'report/banner.html' %] [% INCLUDE 'report/_main.html' %] diff --git a/templates/web/fixmystreet/report/new/category_extras.html b/templates/web/fixmystreet/report/new/category_extras.html deleted file mode 100644 index 48a38435d..000000000 --- a/templates/web/fixmystreet/report/new/category_extras.html +++ /dev/null @@ -1,26 +0,0 @@ -<div id="category_meta"> - [%- IF report_meta %] - [%- category = report.category %] - <h4>Additional Information</h4> - [%- FOR meta IN category_extras.$category %] - [%- meta_name = meta.code -%] - - <label for="form_[% meta_name %]">[% meta.description _ ':' %]</label> - [% IF field_errors.$meta_name %] - <p class='form-error'>[% field_errors.$meta_name %]</p> - [% END -%] - [% IF meta.variable != 'false' %] - [% IF meta.exists('values') %] - <select name="[% meta_name %]" id="form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> - [% FOR option IN meta.values.value %] - <option value="[% option.key.0 %]"[% IF option.key.0 == report_meta.$meta_name.value %] selected[% END %]>[% option.name.0 %]</option> - [% END %] - </select> - [% ELSE %] - <input type="text" value="[% report_meta.$meta_name.value | html %]" name="[% meta_name %]" id="form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> - [% END %] - [% END %] - - [%- END %] - [%- END %] -</div> diff --git a/templates/web/hart/tokens/confirm_problem.html b/templates/web/hart/tokens/confirm_problem.html index 117d2d1bc..68223e92b 100644 --- a/templates/web/hart/tokens/confirm_problem.html +++ b/templates/web/hart/tokens/confirm_problem.html @@ -4,18 +4,16 @@ <p class="confirmed"> Thank you. You have successfully confirmed your report -[% IF c.cobrand.owns_problem( problem ) %] +[% IF c.cobrand.owns_problem( report ) %] and this will now be investigated by the council. -You can <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]">view the problem on this site</a>. +You can <a href="[% c.cobrand.base_url_for_report( report ) %][% report.url %]">view the report on this site</a>. [% ELSE %] and this has now been passed on to [%# TODO make this generic %] <b>Hampshire County Council</b> to investigate. -Note that Hart District Council is not responsible for this type of problem. However you can continue to view your problem on the <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]"><i>fixmystreet.com</i> website</a>. +Note that Hart District Council is not responsible for this type of problem. However you can continue to view your report on the <a href="[% c.cobrand.base_url_for_report( report ) %][% report.url %]"><i>fixmystreet.com</i> website</a>. [% END %] </p> -<p>Your reference for this problem is [% problem.id %], please quote it in any enquiries. +<p>Your reference for this report is [% report.id %], please quote it in any enquiries. </p> -[% display_crosssell_advert( problem.user.email, problem.name ) %] - [% INCLUDE 'footer.html' %] diff --git a/templates/web/seesomething/report_created.html b/templates/web/seesomething/tokens/confirm_problem.html index 4a11d14b4..4a11d14b4 100644 --- a/templates/web/seesomething/report_created.html +++ b/templates/web/seesomething/tokens/confirm_problem.html diff --git a/templates/web/zerotb/report/display.html b/templates/web/zerotb/report/display.html index 697b5428c..9848c89db 100644 --- a/templates/web/zerotb/report/display.html +++ b/templates/web/zerotb/report/display.html @@ -15,12 +15,6 @@ [% INCLUDE 'report/banner.html' %] -[% IF c.flash.comment_created %] -<p> -[% loc('Your report has been sent') %] -</p> -[% END %] - [% INCLUDE 'report/_main.html' %] <div class="shadow-wrap"> diff --git a/templates/web/zurich/tokens/confirm_problem.html b/templates/web/zurich/tokens/confirm_problem.html index d61cf3ffa..d2025f124 100644 --- a/templates/web/zurich/tokens/confirm_problem.html +++ b/templates/web/zurich/tokens/confirm_problem.html @@ -6,8 +6,8 @@ loc('You have successfully confirmed your email address.'); tprintf( loc( 'You can <a href="%s%s">view the problem on this site</a>.' ), - c.cobrand.base_url_for_report( problem ), - problem.url + c.cobrand.base_url_for_report( report ), + report.url ); %] </p> diff --git a/web/cobrands/fixmystreet/base.scss b/web/cobrands/fixmystreet/base.scss index 57eadc435..ff4f4df91 100644 --- a/web/cobrands/fixmystreet/base.scss +++ b/web/cobrands/fixmystreet/base.scss @@ -32,70 +32,59 @@ background: url($image-sprite) -3px -3px no-repeat; } -.confirmation-header { - padding: 2em 1em; +.next-steps { + margin: 0 -1em; // counteract padding on parent + background-color: #faf7e2; +} - @media only screen and (min-width: 48em) { - padding: 3em 0; - text-align: center; +.next-steps__step { + box-sizing: border-box; + padding: 1em; + + & + .next-steps__step { + border-top: 1px solid #ede8c9; } - h1 { + h2 { margin-top: 0; } p { - font-size: 1.3em; - line-height: 1.4em; + color: #666666; margin-bottom: 0; } - - p + p { - margin-top: 0.5em; - } } -.advert-mobile-apps { - margin: 0 -1em; // counteract padding on parent - background-color: #fff9cc; - padding: 2em; - - @media only screen and (min-width: 48em) { - padding-left: 37%; - background: #fff9cc url(/cobrands/fixmystreet/images/advert-app-watercolour.jpg) 7% 50% no-repeat; - } +.next-steps__step__cta { + @include pie-clearfix; + padding-top: 0.4em; // extra padding between buttons and previous paragraph - h1 { - margin-top: 0; - } + a { + float: left; + margin: 1em 0.6em 0 0; - p { - font-size: 1.3em; - line-height: 1.4em; + &:last-child { + margin-right: 0; + } } - .app-links { - @include clearfix; - margin-bottom: 1em; + .next-steps__step--goodies { + min-height: 37px; // stop absolutely positioned img overlapping bottom of parent element - a { - float: left; - margin-right: 1em; - } - - a[href*="itunes.apple.com"] { - margin-top: 3px; // compensate for slightly smaller itunes button + img { + // absolute positioning to overlap floated goodies image to the right + position: absolute; + max-width: none; } } +} - .desktop-advice { - clear: left; - font-size: 1em; - line-height: 1.2em; - color: #745D17; // brown +.next-steps__step--goodies { + @include pie-clearfix; - @media only screen and (min-width: 48em) { - width: 28em; // break line at a nice point - } + .goodies-preview { + float: right; + margin-left: 1em; + margin-right: -0.5em; } } diff --git a/web/cobrands/fixmystreet/images/advert-app-watercolour.jpg b/web/cobrands/fixmystreet/images/advert-app-watercolour.jpg Binary files differdeleted file mode 100644 index 9c372fed5..000000000 --- a/web/cobrands/fixmystreet/images/advert-app-watercolour.jpg +++ /dev/null diff --git a/web/cobrands/fixmystreet/images/next-step-apple.png b/web/cobrands/fixmystreet/images/next-step-apple.png Binary files differnew file mode 100644 index 000000000..79476f552 --- /dev/null +++ b/web/cobrands/fixmystreet/images/next-step-apple.png diff --git a/web/cobrands/fixmystreet/images/next-step-download.png b/web/cobrands/fixmystreet/images/next-step-download.png Binary files differnew file mode 100644 index 000000000..525c27d1f --- /dev/null +++ b/web/cobrands/fixmystreet/images/next-step-download.png diff --git a/web/cobrands/fixmystreet/images/next-step-facebook.png b/web/cobrands/fixmystreet/images/next-step-facebook.png Binary files differnew file mode 100644 index 000000000..c01fa6ced --- /dev/null +++ b/web/cobrands/fixmystreet/images/next-step-facebook.png diff --git a/web/cobrands/fixmystreet/images/next-step-goodies.png b/web/cobrands/fixmystreet/images/next-step-goodies.png Binary files differnew file mode 100644 index 000000000..27fe702c3 --- /dev/null +++ b/web/cobrands/fixmystreet/images/next-step-goodies.png diff --git a/web/cobrands/fixmystreet/images/next-step-google.png b/web/cobrands/fixmystreet/images/next-step-google.png Binary files differnew file mode 100644 index 000000000..6b2244c44 --- /dev/null +++ b/web/cobrands/fixmystreet/images/next-step-google.png diff --git a/web/cobrands/fixmystreet/images/next-step-twitter.png b/web/cobrands/fixmystreet/images/next-step-twitter.png Binary files differnew file mode 100644 index 000000000..e79255bd6 --- /dev/null +++ b/web/cobrands/fixmystreet/images/next-step-twitter.png diff --git a/web/cobrands/fixmystreet/images/sad-face-in-circle-100px.png b/web/cobrands/fixmystreet/images/sad-face-in-circle-100px.png Binary files differnew file mode 100644 index 000000000..093c3ea06 --- /dev/null +++ b/web/cobrands/fixmystreet/images/sad-face-in-circle-100px.png diff --git a/web/cobrands/fixmystreet/images/tick-in-circle-100px.png b/web/cobrands/fixmystreet/images/tick-in-circle-100px.png Binary files differnew file mode 100644 index 000000000..54647a012 --- /dev/null +++ b/web/cobrands/fixmystreet/images/tick-in-circle-100px.png diff --git a/web/cobrands/fixmystreet/layout.scss b/web/cobrands/fixmystreet/layout.scss index ded1ed911..20ea2f11a 100644 --- a/web/cobrands/fixmystreet/layout.scss +++ b/web/cobrands/fixmystreet/layout.scss @@ -256,3 +256,30 @@ body.alertindex { display: none; } } + +.next-steps { + @include clearfix; + margin-bottom: 2em; // add some space between this and the footer +} + +.next-steps__step { + font-family: MuseoSans,Helmet,Freesans,sans-serif; + float: left; + width: 33%; + padding: 1.8em; + + & + .next-steps__step { + border-top: none; + border-left: 1px solid #ede8c9; + } + + h2 { + font-family: inherit; + font-weight: bold; + line-height: 1.2em; + } + + p { + line-height: 1.4em; + } +} diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index 5bc1105cf..8e2a65d1b 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -64,13 +64,13 @@ h3 { h4 { font-size: 1em; font-weight: normal; - margin-bottom: 1em; + margin-bottom: 1em; } // default list styles ul, ol { font-size: 1em; - margin-bottom: 2em; + margin-bottom: 2em; margin-left: 2em; padding:0; } @@ -171,7 +171,7 @@ a:visited { &:hover, &:active { text-decoration:underline; - color:#0D7CCE; + color:#0D7CCE; } } @@ -711,7 +711,7 @@ a.button-left { font-size: 1em; line-height: 1; margin:0; - border:1px solid #999; + border:1px solid #999; color:#333; background: #eee; @include border-radius(4px); @@ -719,7 +719,7 @@ a.button-left { color:#fff; background:#777; text-decoration: none; - border:1px solid #666; + border:1px solid #666; } } .button-right, @@ -1577,4 +1577,47 @@ table.nicetable { } } +.confirmation-header { + padding: 140px 0 2em; + text-align: center; + + background: transparent url(/cobrands/fixmystreet/images/tick-in-circle-100px.png) center 1em no-repeat; + &.confirmation-header--failure { + background-image: url(/cobrands/fixmystreet/images/sad-face-in-circle-100px.png); + } + + h1, h2 { + margin: 0; + line-height: 1.2em; + } + + h1 { + a { + text-decoration: underline; + color: inherit; + + &:hover, + &:focus { + text-decoration: none; + color: #0BA7D1; // default link colour + } + } + } + + h1 + h2, + h1 ~ p { + margin-top: 12px; + } + + p { + color: #666666; + font-size: 1.2em; + margin-bottom: 0.5em; + } + + & > :last-child { + margin-bottom: 0; + } +} + @import "_admin"; diff --git a/web/cobrands/sass/_layout.scss b/web/cobrands/sass/_layout.scss index d1cfb6be7..162bf30e1 100644 --- a/web/cobrands/sass/_layout.scss +++ b/web/cobrands/sass/_layout.scss @@ -1080,6 +1080,14 @@ body.frontpage { } } +.confirmation-header { + width: 25em; + margin: 0 auto 1em; + text-align: left; + padding: 3em 0 3em 132px; // for tick icon + background-position: 0 2em; +} + /* Admin interface */ .fms-admin-floated { diff --git a/web/css/core.scss b/web/css/core.scss index ed47cb01a..897b2d095 100644 --- a/web/css/core.scss +++ b/web/css/core.scss @@ -65,19 +65,6 @@ $map_width: 500px; clear: both; } - // Site-wide layout - - #advert_thin { - width: 50%; - margin: 1em auto; - text-align: center; - border-top: dotted 1px #999999; - } - #advert_hfymp { - border-top: dotted 1px #999999; - text-align: center; - } - // Front page p#expl { |