aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-10-10 08:13:51 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-10-10 08:25:05 +0100
commit12f5a59de622f268d6024a09d07d044f9eb5b5aa (patch)
tree8624660f02b0b2e4d4fc93093aa503a8f8daa8db
parent68e18ffea411f6f6fbb0b4424c6aa6c14fd8cd00 (diff)
[Oxfordshire] Remove defect type front end code.
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm8
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm6
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm7
-rw-r--r--t/app/controller/report_inspect.t27
-rw-r--r--templates/web/base/admin/defecttypes/list.html3
-rw-r--r--templates/web/base/defect_type/format.html9
-rw-r--r--templates/web/base/report/_inspect.html12
-rw-r--r--templates/web/oxfordshire/defect_type/format.html4
-rw-r--r--templates/web/oxfordshire/footer_extra_js.html1
-rw-r--r--web/cobrands/fixmystreet/staff.js6
-rw-r--r--web/cobrands/oxfordshire/js.js5
11 files changed, 1 insertions, 87 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index c2c321b5d..692379de6 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -515,14 +515,6 @@ sub inspect : Private {
}
}
- if ($permissions->{report_inspect}) {
- if ( $c->get_param('defect_type') ) {
- $problem->defect_type($problem->defect_types->find($c->get_param('defect_type')));
- } else {
- $problem->defect_type(undef);
- }
- }
-
$c->cobrand->call_hook(report_inspect_update_extra => $problem);
if ($valid) {
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 5407ec937..03623259c 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -706,12 +706,6 @@ sub setup_categories_and_bodies : Private {
# keysort does not appear to obey locale so use strcoll (see i18n.t)
@contacts = sort { strcoll( $a->category, $b->category ) } @contacts;
- # Get defect types for inspectors
- if ($c->cobrand->can('council_area_id')) {
- my $category_defect_types = FixMyStreet::App->model('DB::DefectType')->by_categories($c->cobrand->council_area_id, @contacts);
- $c->stash->{category_defect_types} = $category_defect_types;
- }
-
my %seen;
foreach my $contact (@contacts) {
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
index 50b71bb69..f99cdf84d 100644
--- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
@@ -172,13 +172,6 @@ sub admin_pages {
return $pages;
}
-sub defect_types {
- {
- SFP2 => "SFP2: sweep and fill <1m2",
- POT2 => "POT2",
- };
-}
-
sub reputation_increment_states {
return {
'action scheduled' => 1,
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index d319f778a..b6498e840 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -8,14 +8,6 @@ my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council', { can_be_de
my $contact = $mech->create_contact_ok( body_id => $oxon->id, category => 'Cows', email => 'cows@example.net' );
my $contact2 = $mech->create_contact_ok( body_id => $oxon->id, category => 'Sheep', email => 'SHEEP', send_method => 'Open311' );
my $contact3 = $mech->create_contact_ok( body_id => $oxon->id, category => 'Badgers', email => 'badgers@example.net' );
-my $dt = FixMyStreet::DB->resultset("DefectType")->create({
- body => $oxon,
- name => 'Small Defect', description => "Teeny",
-});
-FixMyStreet::DB->resultset("ContactDefectType")->create({
- contact => $contact,
- defect_type => $dt,
-});
my $rp = FixMyStreet::DB->resultset("ResponsePriority")->create({
body => $oxon,
name => 'High Priority',
@@ -443,24 +435,6 @@ FixMyStreet::override_config {
is $report->response_priority->id, $rp->id, 'response priority set';
};
- subtest "check can set defect type for category when changing from category with no defect types" => sub {
- $report->update({ category => 'Sheep', defect_type_id => undef });
- $user->user_body_permissions->delete;
- $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 => {
- include_update => 0,
- defect_type => $dt->id,
- category => 'Cows',
- }
- });
- $report->discard_changes;
- is $report->defect_type->id, $dt->id, 'defect type set';
- $report->update({ defect_type_id => undef });
- };
-
subtest "check can't set priority that isn't for a category" => sub {
$report->discard_changes;
$report->update({ category => 'Cows', response_priority_id => $rp->id });
@@ -683,7 +657,6 @@ FixMyStreet::override_config {
priority => $rp->id,
include_update => '1',
detailed_information => 'XXX164XXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
- defect_type => '',
traffic_information => ''
};
my $values = $mech->visible_form_values('report_inspect_form');
diff --git a/templates/web/base/admin/defecttypes/list.html b/templates/web/base/admin/defecttypes/list.html
index ffff89eff..5730710d9 100644
--- a/templates/web/base/admin/defecttypes/list.html
+++ b/templates/web/base/admin/defecttypes/list.html
@@ -10,10 +10,9 @@
</tr>
</thead>
<tbody>
- [% PROCESS 'defect_type/format.html' %]
[% FOR d IN defect_types %]
<tr>
- <td> [% defect_type_format(defect_type=d) %] </td>
+ <td> [% d.name | html %] </td>
<td> [% d.description | html %] </td>
<td>
[% UNLESS d.contacts.size %]
diff --git a/templates/web/base/defect_type/format.html b/templates/web/base/defect_type/format.html
deleted file mode 100644
index 3c0781501..000000000
--- a/templates/web/base/defect_type/format.html
+++ /dev/null
@@ -1,9 +0,0 @@
-[%
-# This template can be overridden by cobrands if they've added extra fields
-# to the DefectType model (e.g Cobrand::Oxfordshire->defect_type_extra_fields)
-# which should be used to represent this DefectType
-# to the user in the inspect form.
-~%]
-[% MACRO defect_type_format BLOCK ~%]
-[%~ defect_type.name | html ~%]
-[%~ END %] \ No newline at end of file
diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html
index 80c5cc1af..7a337b7bb 100644
--- a/templates/web/base/report/_inspect.html
+++ b/templates/web/base/report/_inspect.html
@@ -27,7 +27,6 @@
<p data-category="[% cat_name | html %]"
[%~ IF cat_name != problem.category %] class="hidden"[% END %]
data-priorities='[% priorities_by_category.$cat_name | html %]'
- data-defect-types='[% category_defect_types.$cat_name | html %]'
data-templates='[% templates_by_category.$cat_name | html %]'>
[% IF cat_name == problem.category %]
[% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$cat_name hide_notices=1 show_hidden=1 %]
@@ -38,17 +37,6 @@
[% END %]
[% IF permissions.report_inspect %]
- [% PROCESS 'defect_type/format.html' %]
- <p>
- <label for="defect_type">[% loc('Defect type') %]</label>
- <select id="defect_type" name="defect_type" class="form-control">
- <option value=""[% ' selected' IF NOT problem.defect_type %]>-</option>
- [% FOREACH defect_type IN problem.defect_types %]
- <option[% ' selected' IF problem.defect_type_id == defect_type.id %] value="[% defect_type.id %]">[% defect_type_format() %]</option>
- [% END %]
- </select>
- </p>
-
<p>
<label for="state">[% loc('State') %]</label>
[% INCLUDE 'report/inspect/state_groups_select.html' %]
diff --git a/templates/web/oxfordshire/defect_type/format.html b/templates/web/oxfordshire/defect_type/format.html
deleted file mode 100644
index 9cbf2d873..000000000
--- a/templates/web/oxfordshire/defect_type/format.html
+++ /dev/null
@@ -1,4 +0,0 @@
-[% MACRO defect_type_format BLOCK ~%]
-[%~ defect_type.get_extra_metadata('defect_code') | html %] - [% defect_type.get_extra_metadata('activity_code') | html %]
-([% defect_type.name | html %])
-[%~ END %] \ No newline at end of file
diff --git a/templates/web/oxfordshire/footer_extra_js.html b/templates/web/oxfordshire/footer_extra_js.html
index 1c48aa5cf..d3f1f03ee 100644
--- a/templates/web/oxfordshire/footer_extra_js.html
+++ b/templates/web/oxfordshire/footer_extra_js.html
@@ -3,7 +3,6 @@ IF bodyclass.match('mappage');
scripts.push(
version('/cobrands/fixmystreet/assets.js'),
version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'),
- version('/cobrands/oxfordshire/js.js'),
version('/cobrands/highways/assets.js'),
version('/cobrands/fixmystreet-uk-councils/council_validation_rules.js'),
);
diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js
index cea136cb3..072427053 100644
--- a/web/cobrands/fixmystreet/staff.js
+++ b/web/cobrands/fixmystreet/staff.js
@@ -176,8 +176,6 @@ fixmystreet.staff_set_up = {
selector = "[data-category='" + category + "']",
entry = $inspect_form.find(selector),
$priorities = $('#problem_priority'),
- $defect_types = $('#defect_type'),
- defect_types_data = entry.data('defect-types') || [],
priorities_data = entry.data('priorities') || [],
curr_pri = $priorities.val();
@@ -185,7 +183,6 @@ fixmystreet.staff_set_up = {
entry.removeClass("hidden");
populateSelect($priorities, priorities_data, 'priorities_type_format');
- populateSelect($defect_types, defect_types_data, 'defect_type_format');
updateTemplates({'category': category});
$priorities.val(curr_pri);
});
@@ -457,9 +454,6 @@ $(fixmystreet).on('map:zoomend', function() {
fixmystreet.utils = fixmystreet.utils || {};
$.extend(fixmystreet.utils, {
- defect_type_format: function(data) {
- return data.name;
- },
priorities_type_format: function(data) {
return data.name;
},
diff --git a/web/cobrands/oxfordshire/js.js b/web/cobrands/oxfordshire/js.js
deleted file mode 100644
index ad9639383..000000000
--- a/web/cobrands/oxfordshire/js.js
+++ /dev/null
@@ -1,5 +0,0 @@
-fixmystreet.utils = fixmystreet.utils || {};
-
-fixmystreet.utils.defect_type_format = function(data) {
- return data.extra.defect_code + ' - ' + data.extra.activity_code + ' (' + data.name + ')';
-};