aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm65
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm17
-rw-r--r--perllib/FixMyStreet/TestMech.pm4
-rw-r--r--t/app/controller/photo.t36
-rw-r--r--t/app/controller/questionnaire.t21
-rw-r--r--t/app/controller/report_updates.t55
-rw-r--r--templates/email/default/_email_settings.html3
-rw-r--r--templates/email/default/questionnaire.html7
-rw-r--r--templates/email/fixamingata/questionnaire.html7
-rw-r--r--templates/web/base/questionnaire/index.html42
-rw-r--r--templates/web/base/report/update.html3
-rw-r--r--templates/web/base/report/updates.html2
13 files changed, 205 insertions, 59 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 82e79cc35..e05f8c4fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,8 @@
## Releases
* Unreleased
+ - Front end improvements:
+ - Improve questionnaire process. #1939 #1998
- Admin improvements:
- Inspectors can set non_public status of reports. #1992
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
index 1b338732b..58848f546 100755
--- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm
+++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
@@ -27,13 +27,13 @@ finds out if this user has answered the "ever reported" question before.
=cut
sub check_questionnaire : Private {
- my ( $self, $c ) = @_;
+ my ( $self, $c, $unanswered ) = @_;
my $questionnaire = $c->stash->{questionnaire};
my $problem = $questionnaire->problem;
- if ( $questionnaire->whenanswered ) {
+ if ( $unanswered && $questionnaire->whenanswered ) {
my $problem_url = $c->cobrand->base_url_for_report( $problem ) . $problem->url;
my $contact_url = $c->uri_for( "/contact" );
my $message = sprintf(_("You have already answered this questionnaire. If you have a question, please <a href='%s'>get in touch</a>, or <a href='%s'>view your problem</a>.\n"), $contact_url, $problem_url);
@@ -46,6 +46,11 @@ sub check_questionnaire : Private {
$c->stash->{problem} = $problem;
$c->stash->{answered_ever_reported} = $problem->user->answered_ever_reported;
+ $c->stash->{been_fixed} = $c->get_param('been_fixed') || '';
+
+ # In case they've already visited the questionnaire page, so take what was stored then
+ my $old_state = $c->stash->{old_state} = $questionnaire->old_state || $problem->state;
+ $c->stash->{was_fixed} = FixMyStreet::DB::Result::Problem->fixed_states()->{$old_state};
}
=head2 submit
@@ -144,35 +149,51 @@ sub submit_creator_fixed : Private {
return 1;
}
-sub submit_standard : Private {
+sub record_state_change : Private {
my ( $self, $c ) = @_;
- $c->forward( '/tokens/load_questionnaire', [ $c->get_param('token') ] );
- $c->forward( 'check_questionnaire' );
- $c->forward( 'process_questionnaire' );
+ return unless $c->stash->{been_fixed};
my $problem = $c->stash->{problem};
- my $old_state = $problem->state;
+ my $old_state = $c->stash->{old_state};
my $new_state = '';
- $new_state = 'fixed - user' if $c->stash->{been_fixed} eq 'Yes' &&
+ $new_state = 'fixed - user' if $c->stash->{been_fixed} eq 'Yes' &&
FixMyStreet::DB::Result::Problem->open_states()->{$old_state};
$new_state = 'fixed - user' if $c->stash->{been_fixed} eq 'Yes' &&
FixMyStreet::DB::Result::Problem->closed_states()->{$old_state};
$new_state = 'confirmed' if $c->stash->{been_fixed} eq 'No' &&
FixMyStreet::DB::Result::Problem->fixed_states()->{$old_state};
+ $c->stash->{new_state} = $new_state;
# Record state change, if there was one
if ( $new_state ) {
$problem->state( $new_state );
$problem->lastupdate( \'current_timestamp' );
- }
-
- # If it's not fixed and they say it's still not been fixed, record time update
- if ( $c->stash->{been_fixed} eq 'No' &&
+ } elsif ($problem->state ne $old_state) {
+ $problem->state( $old_state );
+ $problem->lastupdate( \'current_timestamp' );
+ } elsif ( $c->stash->{been_fixed} eq 'No' &&
FixMyStreet::DB::Result::Problem->open_states->{$old_state} ) {
+ # If it's not fixed and they say it's still not been fixed, record time update
$problem->lastupdate( \'current_timestamp' );
}
+ $problem->update;
+ $c->stash->{questionnaire}->update({
+ whenanswered => \'current_timestamp',
+ old_state => $old_state,
+ new_state => $c->stash->{been_fixed} eq 'Unknown' ? 'unknown' : ($new_state || $old_state),
+ });
+}
+
+sub submit_standard : Private {
+ my ( $self, $c ) = @_;
+
+ $c->forward( '/tokens/load_questionnaire', [ $c->get_param('token') ] );
+ $c->forward( 'check_questionnaire' );
+ $c->forward( 'process_questionnaire' );
+ $c->forward( 'record_state_change' );
+
# Record questionnaire response
my $reported = undef;
$reported = 1 if $c->stash->{reported} eq 'Yes';
@@ -180,14 +201,13 @@ sub submit_standard : Private {
my $q = $c->stash->{questionnaire};
$q->update( {
- whenanswered => \'current_timestamp',
ever_reported => $reported,
- old_state => $old_state,
- new_state => $c->stash->{been_fixed} eq 'Unknown' ? 'unknown' : ($new_state || $old_state),
} );
+ my $problem = $c->stash->{problem};
+
# Record an update if they've given one, or if there's a state change
- if ( $new_state || $c->stash->{update} ) {
+ if ( $c->stash->{new_state} || $c->stash->{update} ) {
my $update = $c->stash->{update} || _('Questionnaire filled in by problem reporter');
$update = $c->model('DB::Comment')->new(
{
@@ -196,8 +216,8 @@ sub submit_standard : Private {
user => $problem->user,
text => $update,
state => 'confirmed',
- mark_fixed => $new_state eq 'fixed - user' ? 1 : 0,
- mark_open => $new_state eq 'confirmed' ? 1 : 0,
+ mark_fixed => $c->stash->{new_state} eq 'fixed - user' ? 1 : 0,
+ mark_open => $c->stash->{new_state} eq 'confirmed' ? 1 : 0,
lang => $c->stash->{lang_code},
cobrand => $c->cobrand->moniker,
cobrand_data => '',
@@ -205,6 +225,7 @@ sub submit_standard : Private {
anonymous => $problem->anonymous,
}
);
+ $update->set_extra_metadata( questionnaire_id => $q->id );
if ( my $fileid = $c->stash->{upload_fileid} ) {
$update->photo( $fileid );
}
@@ -216,14 +237,13 @@ sub submit_standard : Private {
if ($c->stash->{been_fixed} eq 'No' || $c->stash->{been_fixed} eq 'Unknown') && $c->stash->{another} eq 'Yes';
$problem->update;
- $c->stash->{new_state} = $new_state;
$c->stash->{template} = 'questionnaire/completed.html';
}
sub process_questionnaire : Private {
my ( $self, $c ) = @_;
- map { $c->stash->{$_} = $c->get_param($_) || '' } qw(been_fixed reported another update);
+ map { $c->stash->{$_} = $c->get_param($_) || '' } qw(reported another update);
$c->stash->{update} = Utils::cleanup_text($c->stash->{update}, { allow_multiline => 1 });
@@ -240,7 +260,7 @@ sub process_questionnaire : Private {
if ($c->stash->{been_fixed} eq 'No' || $c->stash->{been_fixed} eq 'Unknown') && !$c->stash->{another};
push @errors, _('Please provide some explanation as to why you\'re reopening this report')
- if $c->stash->{been_fixed} eq 'No' && $c->stash->{problem}->is_fixed() && !$c->stash->{update};
+ if $c->stash->{been_fixed} eq 'No' && $c->stash->{was_fixed} && !$c->stash->{update};
$c->forward('/photo/process_photo');
push @errors, $c->stash->{photo_error}
@@ -258,7 +278,8 @@ sub process_questionnaire : Private {
# Sent here from email token action. Simply load and display questionnaire.
sub show : Private {
my ( $self, $c ) = @_;
- $c->forward( 'check_questionnaire' );
+ $c->forward( 'check_questionnaire', [ 'unanswered' ] );
+ $c->forward( 'record_state_change' );
$c->forward( 'display' );
}
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index b9d773f5e..ec0e6f886 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -167,17 +167,28 @@ sub load_updates : Private {
{
problem_id => $c->stash->{problem}->id,
whenanswered => { '!=', undef },
- old_state => 'confirmed', new_state => 'confirmed',
+ old_state => [ -and =>
+ { -in => [ FixMyStreet::DB::Result::Problem::closed_states, FixMyStreet::DB::Result::Problem::open_states ] },
+ \'= new_state',
+ ]
},
{ order_by => 'whenanswered' }
);
my @combined;
+ my %questionnaires_with_updates;
while (my $update = $updates->next) {
push @combined, [ $update->confirmed, $update ];
+ if (my $qid = $update->get_extra_metadata('questionnaire_id')) {
+ $questionnaires_with_updates{$qid} = $update;
+ }
}
- while (my $update = $questionnaires->next) {
- push @combined, [ $update->whenanswered, $update ];
+ while (my $q = $questionnaires->next) {
+ if (my $update = $questionnaires_with_updates{$q->id}) {
+ $update->set_extra_metadata('open_from_questionnaire', 1);
+ next;
+ }
+ push @combined, [ $q->whenanswered, $q ];
}
@combined = map { $_->[1] } sort { $a->[0] <=> $b->[0] } @combined;
$c->stash->{updates} = \@combined;
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index ac2ac023d..c5b72a7cf 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -247,7 +247,7 @@ sub get_text_body_from_email {
}
sub get_link_from_email {
- my ($mech, $email, $multiple) = @_;
+ my ($mech, $email, $multiple, $mismatch) = @_;
unless ($email) {
$email = $mech->get_email;
$mech->clear_emails_ok;
@@ -261,7 +261,7 @@ sub get_link_from_email {
if (@links) {
# Must be an HTML part now, first two links are in header
my @html_links = $part->body =~ m{https?://[^"]+}g;
- is $links[0], $html_links[2], 'HTML link matches text link';
+ is $links[0], $html_links[2], 'HTML link matches text link' unless $mismatch;
} else {
@links = $part->body =~ m{https?://\S+}g;
ok @links, "Found links in email '@links'";
diff --git a/t/app/controller/photo.t b/t/app/controller/photo.t
index dbbc697d7..e9183836b 100644
--- a/t/app/controller/photo.t
+++ b/t/app/controller/photo.t
@@ -66,7 +66,43 @@ subtest "Check multiple upload worked" => sub {
'Returned upload_fileid contains expected hash, 3 times');
my $image_file = path($UPLOAD_DIR, '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
ok $image_file->exists, 'File uploaded to temp';
+
+ $mech->submit_form_ok({ with_fields => { name => 'Bob Jones' } });
+ ok $mech->success, 'Made request with multiple photo upload';
};
};
+subtest "Check photo uploading URL works" => sub {
+ my $UPLOAD_DIR = tempdir( CLEANUP => 1 );
+
+ # submit initial pc form
+ FixMyStreet::override_config {
+ UPLOAD_DIR => $UPLOAD_DIR,
+ }, sub {
+ $mech->post( '/photo/upload',
+ Content_Type => 'form-data',
+ Content => {
+ photo1 => [ $sample_file, undef, Content_Type => 'application/octet-stream' ],
+ },
+ );
+ ok $mech->success, 'Made request with multiple photo upload';
+ is $mech->content, '{"id":"74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg"}';
+ my $image_file = path($UPLOAD_DIR, '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
+ ok $image_file->exists, 'File uploaded to temp';
+ };
+};
+
+subtest "Check photo URL endpoints work" => sub {
+ my $p = FixMyStreet::DB->resultset("Problem")->first;
+
+ $mech->get_ok('/photo/temp.74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
+ my $image_file = FixMyStreet->path_to('web/photo/temp.74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
+ ok -e $image_file, 'File uploaded to temp';
+ $mech->get_ok('/photo/' . $p->id . '.jpeg');
+ $image_file = FixMyStreet->path_to('web/photo/' . $p->id . '.jpeg');
+ ok -e $image_file, 'File uploaded to temp';
+ my $res = $mech->get('/photo/0.jpeg');
+ is $res->code, 404, "got 404";
+};
+
done_testing();
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index c6d112df7..75542d759 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -52,7 +52,7 @@ like $plain->body, qr/fill in our short questionnaire/i, "got questionnaire emai
like $plain->body_str, qr/Testing \x{2013} Detail/, 'email contains encoded character';
is $plain->header('Content-Type'), 'text/plain; charset="utf-8"', 'in the right character set';
-my $url = $mech->get_link_from_email($email);
+my $url = $mech->get_link_from_email($email, 0, 1);
my ($token) = $url =~ m{/Q/(\S+)};
ok $token, "extracted questionnaire token '$token'";
$mech->clear_emails_ok;
@@ -108,6 +108,23 @@ foreach my $test (
};
}
+subtest "If been_fixed is provided in the URL" => sub {
+ $mech->get_ok("/Q/" . $token->token . "?been_fixed=Yes");
+ $mech->content_contains('id="been_fixed_yes" value="Yes" checked');
+ $report->discard_changes;
+ is $report->state, 'fixed - user';
+ $questionnaire->discard_changes;
+ is $questionnaire->old_state, 'confirmed';
+ is $questionnaire->new_state, 'fixed - user';
+ $mech->submit_form_ok({ with_fields => { been_fixed => 'Unknown', reported => 'Yes', another => 'No' } });
+ $report->discard_changes;
+ is $report->state, 'confirmed';
+ $questionnaire->discard_changes;
+ is $questionnaire->old_state, 'confirmed';
+ is $questionnaire->new_state, 'unknown';
+ $questionnaire->update({ whenanswered => undef, ever_reported => undef, old_state => undef, new_state => undef });
+};
+
$mech->get_ok("/Q/" . $token->token);
$mech->title_like( qr/Questionnaire/ );
$mech->submit_form_ok( );
@@ -399,7 +416,7 @@ FixMyStreet::override_config {
$mech->clear_emails_ok;
$body =~ s/\s+/ /g;
like $body, qr/fill in our short questionnaire/i, "got questionnaire email";
- my $url = $mech->get_link_from_email($email);
+ my $url = $mech->get_link_from_email($email, 0, 1);
($token) = $url =~ m{/Q/(\S+)};
ok $token, "extracted questionnaire token '$token'";
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index aefe77e47..aba7340b0 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -146,6 +146,42 @@ subtest "unconfirmed updates not displayed" => sub {
};
subtest "several updates shown in correct order" => sub {
+ my @qs;
+ for my $fields ( { # One with an associated update below
+ problem_id => $report_id,
+ whensent => '2011-03-10 12:23:16',
+ whenanswered => '2011-03-10 12:23:16',
+ old_state => 'confirmed',
+ new_state => 'confirmed',
+ },
+ { # One with no associated update
+ problem_id => $report_id,
+ whensent => '2011-03-11 12:23:16',
+ whenanswered => '2011-03-11 12:23:16',
+ old_state => 'confirmed',
+ new_state => 'confirmed',
+ },
+ { # One with no associated update, different state (doesn't match problem state, never mind)
+ problem_id => $report_id,
+ whensent => '2011-03-12 12:23:16',
+ whenanswered => '2011-03-12 12:23:16',
+ old_state => 'investigating',
+ new_state => 'investigating',
+ },
+ { # One for the fixed update
+ problem_id => $report_id,
+ whensent => '2011-03-15 08:12:36',
+ whenanswered => '2011-03-15 08:12:36',
+ old_state => 'confirmed',
+ new_state => 'fixed - user',
+ },
+ ) {
+ my $q = FixMyStreet::App->model('DB::Questionnaire')->find_or_create(
+ $fields
+ );
+ push @qs, $q;
+ }
+
for my $fields ( {
problem_id => $report_id,
user_id => $user2->id,
@@ -180,16 +216,27 @@ subtest "several updates shown in correct order" => sub {
my $comment = FixMyStreet::App->model('DB::Comment')->find_or_create(
$fields
);
+ if ($fields->{text} eq 'Second update') {
+ $comment->set_extra_metadata(questionnaire_id => $qs[0]->id);
+ $comment->update;
+ }
+ if ($fields->{text} eq 'Third update') {
+ $comment->set_extra_metadata(questionnaire_id => $qs[3]->id);
+ $comment->update;
+ }
}
$mech->get_ok("/report/$report_id");
my $meta = $mech->extract_update_metas;
- is scalar @$meta, 4, 'number of updates';
+ is scalar @$meta, 6, 'number of updates';
is $meta->[0], 'Posted by Other User at 12:23, Thu 10 March 2011', 'first update';
- is $meta->[1], 'Posted by Main User at 12:23, Thu 10 March 2011', 'second update';
- is $meta->[2], 'State changed to: Fixed', 'third update, part 1';
- is $meta->[3], 'Posted anonymously at 08:12, Tue 15 March 2011', 'third update, part 2';
+ is $meta->[1], 'Posted by Main User at 12:23, Thu 10 March 2011 Still open, via questionnaire', 'second update';
+ is $meta->[2], 'Still open, via questionnaire, 12:23, Fri 11 March 2011', 'questionnaire';
+ is $meta->[3], 'Still open, via questionnaire, 12:23, Sat 12 March 2011', 'questionnaire';
+ is $meta->[4], 'State changed to: Fixed', 'third update, part 1';
+ is $meta->[5], 'Posted anonymously at 08:12, Tue 15 March 2011', 'third update, part 2';
+ $report->questionnaires->delete;
};
for my $test (
diff --git a/templates/email/default/_email_settings.html b/templates/email/default/_email_settings.html
index d94466c02..54abc2b50 100644
--- a/templates/email/default/_email_settings.html
+++ b/templates/email/default/_email_settings.html
@@ -43,9 +43,11 @@ button_border_radius = "4px" # a full CSS border-radius property
button_background_color = color_yellow
button_background_color_fixed = color_green_dark
button_background_color_notfixed = color_red_dark
+button_background_color_dontknow = color_yellow
button_text_color = color_black
button_text_color_fixed = color_white
button_text_color_notfixed = color_white
+button_text_color_dontknow = color_black
button_font_weight = "bold"
%]
@@ -101,6 +103,7 @@ contact_td_style = "vertical-align: top; padding: 0.4em 0 0.4em 0; width: 100%;"
button_style = "display: inline-block; border: 10px solid $button_background_color; border-width: 10px 15px; border-radius: $button_border_radius; background-color: $button_background_color; color: $button_text_color; font-size: 18px; line-height: 21px; font-weight: $button_font_weight; text-decoration: underline;"
fixed_button_style = "$button_style border-color: $button_background_color_fixed; background-color: $button_background_color_fixed; color: $button_text_color_fixed; margin: 0 0.2em;"
notfixed_button_style = "$button_style border-color: $button_background_color_notfixed; background-color: $button_background_color_notfixed; color: $button_text_color_notfixed; margin: 0 0.2em;"
+dontknow_button_style = "$button_style border-color: $button_background_color_dontknow; background-color: $button_background_color_dontknow; color: $button_text_color_dontknow; margin: 0 0.2em;"
%]
diff --git a/templates/email/default/questionnaire.html b/templates/email/default/questionnaire.html
index 6d9c32af4..eaa570ae0 100644
--- a/templates/email/default/questionnaire.html
+++ b/templates/email/default/questionnaire.html
@@ -16,8 +16,11 @@ INCLUDE '_email_top.html';
<p style="[% p_style %]">[% created %] ago, you reported a problem using [% site_name %].</p>
<p style="[% p_style %]">Help us keep [% site_name %] up to date by letting us know whether the problem has been fixed yet:</p>
<p style="margin: 20px auto; text-align: center">
- <a style="[% fixed_button_style %]" href="[% url %]">Fixed</a>
- <a style="[% notfixed_button_style %]" href="[% url %]">Not fixed</a>
+ <a style="[% fixed_button_style %]" href="[% url %]?been_fixed=Yes">Fixed</a>
+ <a style="[% notfixed_button_style %]" href="[% url %]?been_fixed=No">Not fixed</a>
+ </p>
+ <p style="margin: 20px auto; text-align: center">
+ <a style="[% dontknow_button_style %]" href="[% url %]?been_fixed=Unknown">Don’t know</a>
</p>
<p style="[% p_style %]">Thank you! Your feedback is really valuable.</p>
[% end_padded_box %]
diff --git a/templates/email/fixamingata/questionnaire.html b/templates/email/fixamingata/questionnaire.html
index 0f15b478e..d66c50535 100644
--- a/templates/email/fixamingata/questionnaire.html
+++ b/templates/email/fixamingata/questionnaire.html
@@ -16,8 +16,11 @@ INCLUDE '_email_top.html';
<p style="[% p_style %]">[% created %] sedan lämnade du en rapport på FixaMinGata.</p>
<p style="[% p_style %]">För att hålla alla rapporter uppdaterade skulle vi uppskatta om du kunde informera oss om huruvida problemet har blivit fixat än:</p>
<p style="margin: 20px auto; text-align: center">
- <a style="[% fixed_button_style %]" href="[% url %]">Fixat</a>
- <a style="[% notfixed_button_style %]" href="[% url %]">Ej fixat</a>
+ <a style="[% fixed_button_style %]" href="[% url %]?been_fixed=Yes">Fixat</a>
+ <a style="[% notfixed_button_style %]" href="[% url %]?been_fixed=No">Ej fixat</a>
+ </p>
+ <p style="margin: 20px auto; text-align: center">
+ <a style="[% dontknow_button_style %]" href="[% url %]?been_fixed=Unknown">Vet ej</a>
</p>
<p style="[% p_style %]">Tack! Din feedback är värdefull.</p>
[% end_padded_box %]
diff --git a/templates/web/base/questionnaire/index.html b/templates/web/base/questionnaire/index.html
index 12ca36cf2..4305f05c9 100644
--- a/templates/web/base/questionnaire/index.html
+++ b/templates/web/base/questionnaire/index.html
@@ -13,22 +13,6 @@
<h1>[% loc('Questionnaire') %]</h1>
-<h2 class="questionnaire-report-header">[% loc('Your report') %]</h2>
-<div class="questionnaire-report-reminder">
- [% INCLUDE 'report/photo.html' object=problem %]
- <h3 class="questionnaire-report-reminder__report-title">
- <a href="/report/[% problem.id %]">[% problem.title | html %]</a>
- </h3>
- <p class="questionnaire-report-reminder__report-meta">[% problem.meta_line(c) | html %]</p>
- [% IF updates.size %]
- <p class="questionnaire-report-reminder__last-update-header">
- <strong>[% loc('Last update') %]</strong>
- <a href="/report/[% problem.id %]">[% loc('Show all updates') %]</a>
- </p>
- <p class="questionnaire-report-reminder__last-update">&ldquo;[% updates.last.text | add_links %]&rdquo;</p>
- [% END %]
-</div>
-
<form method="post" action="/questionnaire/submit" id="questionnaire"
[%- IF c.cobrand.allow_photo_upload -%]
enctype="multipart/form-data"
@@ -43,8 +27,8 @@
</ul>
[% END %]
-<p>
-[% loc('An update marked this problem as fixed.') IF problem.is_fixed %]
+<p>1.
+[% loc('An update marked this problem as fixed.') IF was_fixed %]
[% loc('Has this problem been fixed?') %]
</p>
@@ -57,8 +41,24 @@
<label class="btn" for="been_fixed_unknown">[% loc('Don&rsquo;t know') %]</label>
</p>
+<h2 class="questionnaire-report-header">[% loc('Your report') %]</h2>
+<div class="questionnaire-report-reminder">
+ [% INCLUDE 'report/photo.html' object=problem %]
+ <h3 class="questionnaire-report-reminder__report-title">
+ <a href="/report/[% problem.id %]">[% problem.title | html %]</a>
+ </h3>
+ <p class="questionnaire-report-reminder__report-meta">[% problem.meta_line(c) | html %]</p>
+ [% IF updates.size %]
+ <p class="questionnaire-report-reminder__last-update-header">
+ <strong>[% loc('Last update') %]</strong>
+ <a href="/report/[% problem.id %]">[% loc('Show all updates') %]</a>
+ </p>
+ <p class="questionnaire-report-reminder__last-update">&ldquo;[% updates.last.text | add_links %]&rdquo;</p>
+ [% END %]
+</div>
+
[% UNLESS answered_ever_reported %]
-<p>[% loc('Have you ever reported a problem to a council before, or is this your first time?') %]</p>
+<p>2. [% loc('Have you ever reported a problem to a council before, or is this your first time?') %]</p>
<p class="segmented-control segmented-control--radio">
<input type="radio" name="reported" id="reported_yes" value="Yes"[% ' checked' IF reported == 'Yes' %]>
<label class="btn" for="reported_yes">[% loc('Reported before') %]</label>
@@ -67,7 +67,7 @@
</p>
[% END %]
-<p>[% loc('If you wish to leave a public update on the problem, please enter it here
+<p>3. [% loc('If you wish to leave a public update on the problem, please enter it here
(please note it will not be sent to the council).') %]</p>
<p><textarea class="form-control" name="update" rows="7" cols="30" placeholder="[% loc('What was your experience of getting the problem fixed?') %]">[% update | html %]</textarea></p>
@@ -98,7 +98,7 @@
[% END %]
<div class="js-another-questionnaire">
- <p>[% loc('Would you like to receive another questionnaire in 4 weeks, reminding you to check the status?') %]</p>
+ <p>4. [% loc('Would you like to receive another questionnaire in 4 weeks, reminding you to check the status?') %]</p>
<p class="segmented-control segmented-control--radio">
<input type="radio" name="another" id="another_yes" value="Yes"[% ' checked' IF another == 'Yes' %]>
<label class="btn" for="another_yes">[% loc('Yes') %]</label>
diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html
index 100deb1ea..bd66c7b13 100644
--- a/templates/web/base/report/update.html
+++ b/templates/web/base/report/update.html
@@ -60,6 +60,9 @@
[% mlog = update.latest_moderation_log_entry(); IF mlog %]
<br />[% tprintf(loc('Moderated by %s at %s'), mlog.admin_user, prettify_dt(mlog.whenedited)) %]
[% END %]
+ [% IF update.get_extra_metadata('open_from_questionnaire') %]
+ <br />[% loc('Still open, via questionnaire') %]
+ [% END %]
</p>
</div>
[% END %]
diff --git a/templates/web/base/report/updates.html b/templates/web/base/report/updates.html
index e8a2d4bd3..1d37c1d99 100644
--- a/templates/web/base/report/updates.html
+++ b/templates/web/base/report/updates.html
@@ -13,7 +13,7 @@
[% IF update.whenanswered %]
[%# A questionnaire update, currently saying report is still open %]
- [% tprintf( loc( 'Still open, via questionnaire, %s' ), prettify_dt( update.whenanswered ) ) %]
+ [% loc('Still open, via questionnaire') %], [% prettify_dt( update.whenanswered ) %]
[% RETURN %]
[% END %]