aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--t/app/controller/report_display.t50
-rw-r--r--templates/web/base/report/_inspect.html4
-rw-r--r--templates/web/base/report/display.html9
-rw-r--r--templates/web/base/report/duplicate-no-updates.html7
-rw-r--r--templates/web/bromley/report/display.html148
-rw-r--r--templates/web/bromley/report/update-form.html137
6 files changed, 190 insertions, 165 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index fb532ddc4..9817a640d 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -25,31 +25,16 @@ my $dt = DateTime->new(
second => 23
);
-my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
- {
- postcode => 'SW1A 1AA',
- bodies_str => '2504',
- areas => ',105255,11806,11828,2247,2504,',
- category => 'Other',
- title => 'Test 2',
- detail => 'Test 2 Detail',
- used_map => 't',
- name => 'Test User',
- anonymous => 'f',
- state => 'confirmed',
- confirmed => $dt->ymd . ' ' . $dt->hms,
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 't',
- latitude => '51.5016605453401',
- longitude => '-0.142497580865087',
- user_id => $user->id,
- }
-);
+my $westminster = $mech->create_body_ok(2504, 'Westminster City Council');
+my ($report, $report2) = $mech->create_problems_for_body(2, $westminster->id, "Example", {
+ user => $user,
+ confirmed => $dt->ymd . ' ' . $dt->hms,
+});
+$report->update({
+ title => 'Test 2',
+ detail => 'Test 2 Detail'
+});
my $report_id = $report->id;
-ok $report, "created test report - $report_id";
subtest "check that no id redirects to homepage" => sub {
$mech->get_ok('/report');
@@ -125,6 +110,22 @@ subtest "check owner of report can view non public reports" => sub {
ok $report->update( { non_public => 0 } ), 'make report public';
};
+subtest "duplicate reports are signposted correctly" => sub {
+ $report2->set_extra_metadata(duplicate_of => $report->id);
+ $report2->state('duplicate');
+ $report2->update;
+
+ my $report2_id = $report2->id;
+ ok $mech->get("/report/$report2_id"), "get '/report/$report2_id'";
+ $mech->content_contains('This report is a duplicate.');
+ $mech->content_contains($report->title);
+ $mech->log_out_ok;
+
+ $report2->unset_extra_metadata('duplicate_of');
+ $report2->state('confirmed');
+ $report2->update;
+};
+
subtest "test a good report" => sub {
$mech->get_ok("/report/$report_id");
is $mech->uri->path, "/report/$report_id", "at /report/$report_id";
@@ -532,5 +533,6 @@ subtest "Zurich banners are displayed correctly" => sub {
END {
$mech->delete_user('test@example.com');
+ $mech->delete_body($westminster);
done_testing();
}
diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html
index 7f41a2d63..6f49f3ecb 100644
--- a/templates/web/base/report/_inspect.html
+++ b/templates/web/base/report/_inspect.html
@@ -80,7 +80,7 @@
<input type="hidden" name="duplicate_of" value="[% problem.duplicate_of.id %]">
<p class="[% "hidden" UNLESS problem.duplicate_of %]"><strong>[% loc('Duplicate of') %]</strong></p>
<p class="[% "hidden" IF problem.duplicate_of %]">[% loc('Which report is it a duplicate of?') %]</p>
- <ul>
+ <ul class="item-list">
[% IF problem.duplicate_of %]
[% INCLUDE 'report/_item.html' item_extra_class = 'item-list--reports__item--selected' problem = problem.duplicate_of %]
<li class="item-list__item"><a class="btn" href="#" id="js-change-duplicate-report">[% loc('Choose another') %]</a></li>
@@ -89,7 +89,7 @@
</div>
[% IF problem.duplicates.size %]
<p><strong>[% loc('Duplicates') %]</strong></p>
- <ul>
+ <ul class="item-list">
[% FOR duplicate IN problem.duplicates %]
[% INCLUDE 'report/_item.html' problem = duplicate %]
[% END %]
diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html
index 1ee5c4636..7c26c4938 100644
--- a/templates/web/base/report/display.html
+++ b/templates/web/base/report/display.html
@@ -40,12 +40,19 @@
[% INCLUDE 'report/banner.html' %]
[% INCLUDE 'report/_main.html' %]
+
+[% IF problem.duplicate_of %]
+ [% INCLUDE 'report/duplicate-no-updates.html' hide_header = 1 %]
+[% END %]
+
[% TRY %][% INCLUDE 'report/_message_manager.html' %][% CATCH file %][% END %]
[% INCLUDE 'report/display_tools.html' %]
[% TRY %][% INCLUDE 'report/sharing.html' %][% CATCH file %][% END %]
[% INCLUDE 'report/updates.html' %]
-[% IF NOT shown_form %]
+[% IF problem.duplicate_of %]
+ [% INCLUDE 'report/duplicate-no-updates.html' %]
+[% ELSIF NOT shown_form %]
[% INCLUDE 'report/update-form.html' %]
[% END %]
diff --git a/templates/web/base/report/duplicate-no-updates.html b/templates/web/base/report/duplicate-no-updates.html
new file mode 100644
index 000000000..eb9ded728
--- /dev/null
+++ b/templates/web/base/report/duplicate-no-updates.html
@@ -0,0 +1,7 @@
+<div>
+ [% UNLESS hide_header %]<h2>[% loc( 'Provide an update') %]</h2>[% END %]
+ <p>[% loc("This report is a duplicate. Please leave updates on the original report:") %]</p>
+ <ul class="item-list">
+ [% INCLUDE 'report/_item.html' item_extra_class = 'item-list__item--with-pin item-list--reports__item--selected' problem = problem.duplicate_of %]
+ </ul>
+</div>
diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html
index 9f2089d28..4c1a69bca 100644
--- a/templates/web/bromley/report/display.html
+++ b/templates/web/bromley/report/display.html
@@ -21,147 +21,19 @@
[% INCLUDE 'report/banner.html' %]
[% INCLUDE 'report/_main.html' %]
-[% INCLUDE 'report/display_tools.html' %]
-[% INCLUDE 'report/updates.html' %]
-
-<div id="update_form">
- <h2>[% loc( 'Provide an update') %]</h2>
-
- [% INCLUDE 'errors.html' %]
-
- <form method="post" action="[% c.uri_for( '/report/update' ) %]" name="updateForm" class="validate"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]>
- <input type="hidden" name="token" value="[% csrf_token %]">
- <fieldset>
- <input type="hidden" name="submit_update" value="1">
- <input type="hidden" name="id" value="[% problem.id | html %]">
-
- [% IF c.cobrand.allow_photo_upload %]
- <input type="hidden" name="upload_fileid" value="[% upload_fileid %]">
- <label for="form_photo">
- <span data-singular="[% loc('Photo') %]" data-plural="[% loc('Photos') %]">[% loc('Photo') %]</span>
- </label>
-
- [% IF field_errors.photo %]
- <p class='form-error'>[% field_errors.photo %]</p>
- [% END %]
-
- <div id="form_photos">
- [% IF upload_fileid %]
- <p>[% loc('You have already attached photos to this update. Note that you can attach a maximum of 3 to this update (if you try to upload more, the oldest will be removed).') %]</p>
- [% FOREACH id IN upload_fileid.split(',') %]
- <img align="right" src="/photo/temp.[% id %]" alt="">
- [% END %]
- [% END %]
- <input type="file" name="photo1" id="form_photo">
- <label for="form_photo2">[% loc('Photo') %]</label>
- <input type="file" name="photo2" id="form_photo2">
- <label for="form_photo3">[% loc('Photo') %]</label>
- <input type="file" name="photo3" id="form_photo3">
- </div>
- [% END %]
-
- <label for="form_update">[% loc( 'Update' ) %]</label>
- [% IF field_errors.update %]
- <div class='form-error'>[% field_errors.update %]</div>
- [% END %]
- <textarea class="form-control" rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea>
-
- <div class="general-notes">
- <p>Please note this comments box can only be used for this report.
- <br><a href="http://www.bromley.gov.uk/report">Report a different issue</a>
- </div>
-
- [% IF c.user && c.user.belongs_to_body( problem.bodies_str ) %]
- <label for="form_state">[% loc( 'State' ) %]</label>
- <select name="state" id="form_state" class="form-control">
- [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating',
- loc('Investigating')], ['action scheduled', loc('Action Scheduled')],
- ['in progress', loc('In Progress')], ['duplicate', loc('Duplicate')],
- ['unable to fix', loc('Unable to fix')], ['not responsible', loc('Not Responsible')],
- ['fixed', loc('Fixed')] ] %]
- <option [% 'selected ' IF state.0 == problem.state_display %] value="[% state.0 %]">[% state.1 %]</option>
- [% END %]
- </select>
- [% ELSE %]
- [% IF problem.is_fixed AND c.user_exists AND c.user.id == problem.user_id %]
-
- <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF update.mark_open %]>
- <label class="inline" for="form_reopen">[% loc('This problem has not been fixed') %]</label>
-
- [% ELSIF !problem.is_fixed %]
-
- <div class="checkbox-group">
- <input type="checkbox" name="fixed" id="form_fixed" value="1"[% ' checked' IF update.mark_fixed %]>
- <label class="inline" for="form_fixed">[% loc('This problem has been fixed') %]</label>
- </div>
-
- [% END %]
- [% END %]
-
- [% IF c.user_exists %]
-
- [% INCLUDE name %]
-
- <input class="final-submit green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]">
+[% IF problem.duplicate_of %]
+ [% INCLUDE 'report/duplicate-no-updates.html' hide_header = 1 %]
+[% END %]
- [% ELSE %]
-
- <label for="form_rznvy">[% loc('Email' ) %]
- <span class="muted">([% loc('We never show your email') %])</span>
- </label>
-
- [% IF field_errors.email %]
- <p class='form-error'>[% field_errors.email %]</p>
- [% END %]
- <input class="form-control" type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" required>
-
- <div id="form_sign_in">
- <p>To submit your update you now need to confirm it either by email or by using a FixMyStreet password.</p>
-
- <div id="form_sign_in_no" class="form-box">
- <h5>Confirm my report by email</h5>
-
- [% INCLUDE name %]
-
- <label for="password_register">[% loc('Password (optional)') %]</label>
-
- <div class="general-notes">
- <p>[% loc('Providing a password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.') %]</p>
- </div>
-
- <div class="form-txt-submit-box">
- <input type="password" class="form-control" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]">
- <input class="green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]">
- </div>
- </div>
- <div id="form_sign_in_yes" class="form-box">
- <h5>Confirm my report with my FixMyStreet password</h5>
-
- <label class="hidden-js n" for="password_sign_in">[% loc('Yes I have a password') %]</label>
- [% IF field_errors.password %]
- <p class='form-error'>[% field_errors.password %]</p>
- [% END %]
- <div class="form-txt-submit-box">
- <input type="password" class="form-control" name="password_sign_in" id="password_sign_in" value="" placeholder="[% loc('Your password') %]">
- <input class="green-btn js-submit_sign_in" type="submit" name="submit_sign_in" value="[% loc('Post') %]">
- </div>
-
- <div class="checkbox-group">
- <input type="checkbox" id="remember_me" name="remember_me" value='1'[% ' checked' IF remember_me %]>
- <label class="inline n" for="remember_me">[% loc('Keep me signed in on this computer') %]</label>
- </div>
- </div>
- </div>
-
- [% END %]
-
- <p>Your information will only be used in accordance with our <a href="/faq#privacy">privacy policy</a>.</p>
-
- </fieldset>
- </form>
-</div>
+[% INCLUDE 'report/display_tools.html' %]
+[% INCLUDE 'report/updates.html' %]
+[% IF problem.duplicate_of %]
+ [% INCLUDE 'report/duplicate-no-updates.html' %]
+[% ELSE %]
+ [% INCLUDE 'report/update-form.html' %]
+[% END %]
</div>
[% INCLUDE 'footer.html' %]
diff --git a/templates/web/bromley/report/update-form.html b/templates/web/bromley/report/update-form.html
new file mode 100644
index 000000000..112cb2960
--- /dev/null
+++ b/templates/web/bromley/report/update-form.html
@@ -0,0 +1,137 @@
+<div id="update_form">
+ <h2>[% loc( 'Provide an update') %]</h2>
+
+ [% INCLUDE 'errors.html' %]
+
+ <form method="post" action="[% c.uri_for( '/report/update' ) %]" name="updateForm" class="validate"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]>
+ <input type="hidden" name="token" value="[% csrf_token %]">
+ <fieldset>
+ <input type="hidden" name="submit_update" value="1">
+ <input type="hidden" name="id" value="[% problem.id | html %]">
+
+ [% IF c.cobrand.allow_photo_upload %]
+ <input type="hidden" name="upload_fileid" value="[% upload_fileid %]">
+ <label for="form_photo">
+ <span data-singular="[% loc('Photo') %]" data-plural="[% loc('Photos') %]">[% loc('Photo') %]</span>
+ </label>
+
+ [% IF field_errors.photo %]
+ <p class='form-error'>[% field_errors.photo %]</p>
+ [% END %]
+
+ <div id="form_photos">
+ [% IF upload_fileid %]
+ <p>[% loc('You have already attached photos to this update. Note that you can attach a maximum of 3 to this update (if you try to upload more, the oldest will be removed).') %]</p>
+ [% FOREACH id IN upload_fileid.split(',') %]
+ <img align="right" src="/photo/temp.[% id %]" alt="">
+ [% END %]
+ [% END %]
+ <input type="file" name="photo1" id="form_photo">
+ <label for="form_photo2">[% loc('Photo') %]</label>
+ <input type="file" name="photo2" id="form_photo2">
+ <label for="form_photo3">[% loc('Photo') %]</label>
+ <input type="file" name="photo3" id="form_photo3">
+ </div>
+ [% END %]
+
+ <label for="form_update">[% loc( 'Update' ) %]</label>
+ [% IF field_errors.update %]
+ <div class='form-error'>[% field_errors.update %]</div>
+ [% END %]
+ <textarea class="form-control" rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea>
+
+ <div class="general-notes">
+ <p>Please note this comments box can only be used for this report.
+ <br><a href="http://www.bromley.gov.uk/report">Report a different issue</a>
+ </div>
+
+ [% IF c.user && c.user.belongs_to_body( problem.bodies_str ) %]
+ <label for="form_state">[% loc( 'State' ) %]</label>
+ <select name="state" id="form_state" class="form-control">
+ [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating',
+ loc('Investigating')], ['action scheduled', loc('Action Scheduled')],
+ ['in progress', loc('In Progress')], ['duplicate', loc('Duplicate')],
+ ['unable to fix', loc('Unable to fix')], ['not responsible', loc('Not Responsible')],
+ ['fixed', loc('Fixed')] ] %]
+ <option [% 'selected ' IF state.0 == problem.state_display %] value="[% state.0 %]">[% state.1 %]</option>
+ [% END %]
+ </select>
+ [% ELSE %]
+ [% IF problem.is_fixed AND c.user_exists AND c.user.id == problem.user_id %]
+
+ <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF update.mark_open %]>
+ <label class="inline" for="form_reopen">[% loc('This problem has not been fixed') %]</label>
+
+ [% ELSIF !problem.is_fixed %]
+
+ <div class="checkbox-group">
+ <input type="checkbox" name="fixed" id="form_fixed" value="1"[% ' checked' IF update.mark_fixed %]>
+ <label class="inline" for="form_fixed">[% loc('This problem has been fixed') %]</label>
+ </div>
+
+ [% END %]
+ [% END %]
+
+ [% IF c.user_exists %]
+
+ [% INCLUDE name %]
+
+ <input class="final-submit green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]">
+
+
+ [% ELSE %]
+
+ <label for="form_rznvy">[% loc('Email' ) %]
+ <span class="muted">([% loc('We never show your email') %])</span>
+ </label>
+
+ [% IF field_errors.email %]
+ <p class='form-error'>[% field_errors.email %]</p>
+ [% END %]
+ <input class="form-control" type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" required>
+
+ <div id="form_sign_in">
+ <p>To submit your update you now need to confirm it either by email or by using a FixMyStreet password.</p>
+
+ <div id="form_sign_in_no" class="form-box">
+ <h5>Confirm my report by email</h5>
+
+ [% INCLUDE name %]
+
+ <label for="password_register">[% loc('Password (optional)') %]</label>
+
+ <div class="general-notes">
+ <p>[% loc('Providing a password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.') %]</p>
+ </div>
+
+ <div class="form-txt-submit-box">
+ <input type="password" class="form-control" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]">
+ <input class="green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]">
+ </div>
+ </div>
+ <div id="form_sign_in_yes" class="form-box">
+ <h5>Confirm my report with my FixMyStreet password</h5>
+
+ <label class="hidden-js n" for="password_sign_in">[% loc('Yes I have a password') %]</label>
+ [% IF field_errors.password %]
+ <p class='form-error'>[% field_errors.password %]</p>
+ [% END %]
+ <div class="form-txt-submit-box">
+ <input type="password" class="form-control" name="password_sign_in" id="password_sign_in" value="" placeholder="[% loc('Your password') %]">
+ <input class="green-btn js-submit_sign_in" type="submit" name="submit_sign_in" value="[% loc('Post') %]">
+ </div>
+
+ <div class="checkbox-group">
+ <input type="checkbox" id="remember_me" name="remember_me" value='1'[% ' checked' IF remember_me %]>
+ <label class="inline n" for="remember_me">[% loc('Keep me signed in on this computer') %]</label>
+ </div>
+ </div>
+ </div>
+
+ [% END %]
+
+ <p>Your information will only be used in accordance with our <a href="/faq#privacy">privacy policy</a>.</p>
+
+ </fieldset>
+ </form>
+</div>