From 312df7e5b0224d9aff0767148879a854089e4ee1 Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Mon, 30 Jan 2017 16:32:52 +0000 Subject: [Oxfordshire] Show simpler state list on inspect form Limits the state dropdown to those states which will be useful to OCC inspectors, as well as removing a few from the base template on the inspect form. Some slight template refactoring has made it easier for other cobrands to override the list, as well as sharing the template with the admin report_edit form to allow all states to be selected. Fixes mysociety/fixmystreetforcouncils#129 --- t/app/controller/report_inspect.t | 8 ++++---- templates/web/base/admin/state_groups_select.html | 13 +----------- templates/web/base/report/_inspect.html | 2 +- templates/web/base/report/_state_select_field.html | 12 +++++++++++ .../base/report/inspect/state_groups_select.html | 24 ++++++++++++++++++++++ .../report/inspect/state_groups_select.html | 21 +++++++++++++++++++ 6 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 templates/web/base/report/_state_select_field.html create mode 100644 templates/web/base/report/inspect/state_groups_select.html create mode 100644 templates/web/oxfordshire/report/inspect/state_groups_select.html diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index f092561db..9888fc0f4 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -57,9 +57,9 @@ FixMyStreet::override_config { }; subtest "test basic inspect submission" => sub { - $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Yes', state => 'Planned', save_inspected => undef } }); + $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Yes', state => 'Action Scheduled', save_inspected => undef } }); $report->discard_changes; - is $report->state, 'planned', 'report state changed'; + is $report->state, 'action scheduled', 'report state changed'; is $report->get_extra_metadata('traffic_information'), 'Yes', 'report data changed'; }; @@ -190,9 +190,9 @@ FixMyStreet::override_config { 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 => 'Planned', save_inspected => undef } }); + $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Action Scheduled', save_inspected => undef } }); $report->discard_changes; - is $report->state, 'planned', 'report state changed'; + is $report->state, 'action scheduled', 'report state changed'; is $report->get_extra_metadata('traffic_information'), 'Signs and Cones', 'report data changed'; }; diff --git a/templates/web/base/admin/state_groups_select.html b/templates/web/base/admin/state_groups_select.html index 229d181ab..9a70cd2c9 100644 --- a/templates/web/base/admin/state_groups_select.html +++ b/templates/web/base/admin/state_groups_select.html @@ -1,14 +1,3 @@ [% PROCESS 'admin/report_blocks.html'; # For state_groups %] [% DEFAULT current_state = problem.state %] - +[% INCLUDE 'report/_state_select_field.html' %] diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index 3118a49b6..5a7e99ef9 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -64,7 +64,7 @@ [% IF permissions.report_inspect %]

- [% INCLUDE 'admin/state_groups_select.html' %] + [% INCLUDE 'report/inspect/state_groups_select.html' %]

diff --git a/templates/web/base/report/_state_select_field.html b/templates/web/base/report/_state_select_field.html new file mode 100644 index 000000000..9b3ed18df --- /dev/null +++ b/templates/web/base/report/_state_select_field.html @@ -0,0 +1,12 @@ + diff --git a/templates/web/base/report/inspect/state_groups_select.html b/templates/web/base/report/inspect/state_groups_select.html new file mode 100644 index 000000000..c4043751b --- /dev/null +++ b/templates/web/base/report/inspect/state_groups_select.html @@ -0,0 +1,24 @@ +[% +SET state_pretty = { + 'confirmed' = loc('Open') + 'investigating' = loc('Investigating') + 'in progress' = loc('In progress') + 'action scheduled' = loc('Action Scheduled') + 'fixed - council' = loc('Fixed - Council') + 'unable to fix' = loc('No further action') + 'not responsible' = loc('Not Responsible') + 'duplicate' = loc('Duplicate') + 'internal referral' = loc('Internal referral') + 'hidden' = loc('Hidden') +}; + +SET state_groups = [ + [ loc('Open'), [ 'confirmed', 'investigating', 'in progress', 'action scheduled' ] ], + [ loc('Fixed'), [ 'fixed - council' ] ], + [ loc('Closed'), [ 'unable to fix', 'not responsible', 'duplicate', 'internal referral' ] ], + [ loc('Hidden'), [ 'hidden' ] ] +]; + +%] +[% DEFAULT current_state = problem.state %] +[% INCLUDE 'report/_state_select_field.html' %] diff --git a/templates/web/oxfordshire/report/inspect/state_groups_select.html b/templates/web/oxfordshire/report/inspect/state_groups_select.html new file mode 100644 index 000000000..d9db3864a --- /dev/null +++ b/templates/web/oxfordshire/report/inspect/state_groups_select.html @@ -0,0 +1,21 @@ +[% +SET state_pretty = { + 'confirmed' = loc('Open') + 'investigating' = loc('Investigating') + 'action scheduled' = loc('Action Scheduled') + 'fixed - council' = loc('Fixed') + 'not responsible' = loc('Not Responsible') + 'duplicate' = loc('Duplicate') + 'unable to fix' = loc('No further action') +}; + +SET state_groups = [ + [ loc('New'), [ 'confirmed', 'investigating' ] ], + [ loc('Scheduled'), [ 'action scheduled' ] ], + [ loc('Fixed'), [ 'fixed - council' ] ], + [ loc('Closed'), [ 'not responsible', 'duplicate', 'unable to fix' ] ] +]; + +%] +[% DEFAULT current_state = problem.state %] +[% INCLUDE 'report/_state_select_field.html' %] -- cgit v1.2.3