diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-10-08 16:33:24 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-10-12 13:38:07 +0100 |
commit | f4a9c33b3deeab5b17721ff42b54cad6a4713317 (patch) | |
tree | 372af7000c9239ba20fd57e4bbd2af7e57d71793 | |
parent | 90d23fc7b21f4391aeb92418e212195a18d72d5e (diff) |
[Oxfordshire] Traffic Management out of base.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 11 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 19 | ||||
-rw-r--r-- | templates/web/base/report/_inspect.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/_item.html | 4 | ||||
-rw-r--r-- | templates/web/base/report/inspect/extra_details.html | 10 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/_inspected.html | 7 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/_raise_defect.html | 12 |
9 files changed, 15 insertions, 66 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 2dfb0d7b1..e58bceb2a 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -1286,14 +1286,6 @@ sub category_extra_hidden { return 0; } -sub traffic_management_options { - return [ - _("Yes"), - _("No"), - ]; -} - - =item display_days_ago_threshold Used to control whether a relative 'n days ago' or absolute date is shown diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index ab0bfe563..8a188d96a 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -215,14 +215,6 @@ sub on_map_default_status { return 'open'; } sub admin_user_domain { 'oxfordshire.gov.uk' } -sub traffic_management_options { - return [ - "Signs and Cones", - "Stop and Go Boards", - "High Speed Roads", - ]; -} - sub admin_pages { my $self = shift; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index cd5e876b4..ceb41b40f 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -1125,17 +1125,6 @@ has duplicates => ( }, ); -has traffic_management_options => ( - is => 'ro', - lazy => 1, - default => sub { - my $self = shift; - my $cobrand = $self->get_cobrand_logged; - $cobrand = $cobrand->call_hook(get_body_handler_for_problem => $self) || $cobrand; - return $cobrand->traffic_management_options; - }, -); - has inspection_log_entry => ( is => 'ro', lazy => 1, diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index d5eaed2c1..3f267a086 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -60,7 +60,6 @@ FixMyStreet::override_config { $mech->content_lacks('Save changes'); $mech->content_lacks('Private'); $mech->content_lacks('Priority'); - $mech->content_lacks('Traffic management'); $mech->content_lacks('Change asset'); $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)'); @@ -70,7 +69,6 @@ FixMyStreet::override_config { $mech->content_contains('Save changes'); $mech->content_lacks('Change asset'); $mech->content_lacks('Priority'); - $mech->content_lacks('Traffic management'); $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)'); $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_edit_priority' }); @@ -79,7 +77,6 @@ FixMyStreet::override_config { $mech->content_contains('Save changes'); $mech->content_contains('Priority'); $mech->content_lacks('Change asset'); - $mech->content_lacks('Traffic management'); $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)'); $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' }); @@ -87,7 +84,6 @@ FixMyStreet::override_config { $mech->content_contains('Save changes'); $mech->content_contains('Private'); $mech->content_contains('Priority'); - $mech->content_contains('Traffic management'); $mech->content_contains('Change asset'); $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)'); }; @@ -210,14 +206,14 @@ FixMyStreet::override_config { $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' }); $mech->get_ok("/report/$report_id"); - $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Yes', state => 'Action scheduled', include_update => undef } }); + $mech->submit_form_ok({ button => 'save', with_fields => { detailed_information => 'Info', state => 'Action scheduled', include_update => undef } }); $report->discard_changes; my $alert = FixMyStreet::DB->resultset('Alert')->find( { user => $user, alert_type => 'new_updates', confirmed => 1, } ); is $report->state, 'action scheduled', 'report state changed'; - is $report->get_extra_metadata('traffic_information'), 'Yes', 'report data changed'; + is $report->get_extra_metadata('detailed_information'), 'Info', 'report data changed'; ok defined( $alert ) , 'sign up for alerts'; }; @@ -703,15 +699,6 @@ FixMyStreet::override_config { return $perms; }); - subtest "Oxfordshire-specific traffic management options are shown" => sub { - $report->update({ state => 'confirmed' }); - $mech->get_ok("/report/$report_id"); - $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Action scheduled', include_update => undef } }); - $report->discard_changes; - is $report->state, 'action scheduled', 'report state changed'; - is $report->get_extra_metadata('traffic_information'), 'Signs and Cones', 'report data changed'; - }; - subtest "admin link present on inspect page on cobrand" => sub { my $report_edit_permission = $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_edit' }); @@ -745,7 +732,6 @@ FixMyStreet::override_config { priority => $rp->id, include_update => '1', detailed_information => 'XXX164XXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', - traffic_information => '', photo1 => '', photo2 => '', photo3 => '', @@ -919,6 +905,7 @@ FixMyStreet::override_config { $mech->get_ok("/report/$report2_id"); $mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", include_update => "1", + traffic_information => 'Signs and cones', state => 'action scheduled', raise_defect => 1, defect_item_category => 'Kerbing', } }); diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index f7d8cc056..1877640b4 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -71,8 +71,6 @@ [% INCLUDE 'report/inspect/public_update.html' %] [% END %] - [% TRY %][% INCLUDE 'report/inspect/_inspected.html' %][% CATCH file %][% END %] - <p> <input type="hidden" name="token" value="[% csrf_token %]" /> [% IF permissions.planned_reports %] diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 9a5168986..f25d5d2a1 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -96,10 +96,6 @@ END; <p>[% problem.response_priority.name OR '-' %]</p> </div> <div> - <h4>[% loc('Traffic management required?') %]</h4> - <p>[% problem.get_extra_metadata('traffic_information') %]</p> - </div> - <div> <h4>[% loc('Extra details') %]</h4> <p>[% problem.get_extra_metadata('detailed_information') | html %]</p> </div> diff --git a/templates/web/base/report/inspect/extra_details.html b/templates/web/base/report/inspect/extra_details.html index 66e464cef..621ae3688 100644 --- a/templates/web/base/report/inspect/extra_details.html +++ b/templates/web/base/report/inspect/extra_details.html @@ -9,15 +9,5 @@ </p> [% IF permissions.report_inspect %] - <p> - <label for="traffic_information">[% loc('Traffic management required?') %]</label> - [% traffic_info = problem.get_extra_metadata('traffic_information') %] - <select id="traffic_information" name="traffic_information" class="form-control"> - <option value=""[% ' selected' IF NOT traffic_info %]>-</option> - [% FOREACH option IN problem.traffic_management_options %] - <option value='[% option %]'[% ' selected' IF traffic_info == option %]>[% option %]</option> - [% END %] - </select> - </p> [% INCLUDE 'report/inspect/_extra_details_field.html' %] [% END %] diff --git a/templates/web/oxfordshire/report/inspect/_inspected.html b/templates/web/oxfordshire/report/inspect/_inspected.html deleted file mode 100644 index 58d6c1528..000000000 --- a/templates/web/oxfordshire/report/inspect/_inspected.html +++ /dev/null @@ -1,7 +0,0 @@ -[% IF problem.get_extra_metadata('inspected') %] -[% IF problem.whensent %] - <p>[% loc("<strong>Note:</strong> This report has been sent onwards for action. Any changes made won't be passed on.") %]</p> -[% ELSE %] - <p>[% loc("<strong>Note:</strong> This report hasn't yet been sent onwards for action. Any changes made may not be passed on.") %]</p> -[% END %] -[% END %] diff --git a/templates/web/oxfordshire/report/inspect/_raise_defect.html b/templates/web/oxfordshire/report/inspect/_raise_defect.html index b2cdf7487..87224a4e2 100644 --- a/templates/web/oxfordshire/report/inspect/_raise_defect.html +++ b/templates/web/oxfordshire/report/inspect/_raise_defect.html @@ -14,6 +14,9 @@ <dt>Location description</dt> <dd>[% problem.get_extra_metadata('defect_location_description') %]</dd> + + <dt>Traffic management required?</dt> + <dd>[% problem.get_extra_metadata('traffic_information') %]</dd> </dl> [% ELSE %] @@ -67,6 +70,15 @@ </optgroup> </select> + <label for="traffic_information">[% loc('Traffic management required?') %]</label> + [% traffic_info = problem.get_extra_metadata('traffic_information') %] + <select id="traffic_information" name="traffic_information" class="form-control"> + <option value=""[% ' selected' IF NOT traffic_info %]>-</option> + [% FOREACH option IN ['Signs and Cones', 'Stop and Go Boards'] %] + <option value='[% option %]'[% ' selected' IF traffic_info == option %]>[% option %]</option> + [% END %] + </select> + <label for="defect_location_description">Location description</label> <textarea rows="2" id="defect_location_description" name="defect_location_description" class="form-control"></textarea> |