Skip to content

Commit

Permalink
[Bucks] Changes to parish/council name display
Browse files Browse the repository at this point in the history
When making a report to a parish Bucks have asked for only the parish
name to be displayed. This commit changes the header section of the
category extras and adds a tiny bit of JS to handle updating the
displayed body name when the grass cutting question is answered.
Include the fix on .com as well.
  • Loading branch information
chrismytton authored and dracos committed Aug 22, 2022
1 parent 78a22aa commit fa822e1
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .cypress/cypress/integration/buckinghamshire.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,38 @@ describe('buckinghamshire cobrand', function() {
cy.contains('The road you have selected is on a regular gritting route').should('be.visible');
});

describe("Parish grass cutting category speed limit question", function() {
var speedGreaterThan30 = '#form_speed_limit_greater_than_30';

beforeEach(function() {
cy.get('#map_box').click(290, 307);
cy.wait('@report-ajax');
cy.pickCategory('Grass cutting');
cy.wait('@around-ajax');
cy.nextPageReporting();
});

it('displays the parish name if answer is "no"', function() {
cy.get(speedGreaterThan30).select('no');
cy.nextPageReporting();
cy.nextPageReporting();
cy.contains('sent to Adstock Parish Council and also published online').should('be.visible');
});

it('displays the council name if answer is "yes"', function() {
cy.get(speedGreaterThan30).select('yes');
cy.nextPageReporting();
cy.nextPageReporting();
cy.contains('sent to Buckinghamshire Council and also published online').should('be.visible');
});

it('displays the council name if answer is "dont_know"', function() {
cy.get(speedGreaterThan30).select('dont_know');
cy.nextPageReporting();
cy.nextPageReporting();
cy.contains('sent to Buckinghamshire Council and also published online').should('be.visible');
});
});
});

describe('buckinghamshire roads handling', function() {
Expand Down
30 changes: 30 additions & 0 deletions bin/fixmystreet.com/fixture
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ if ($opt->test_fixtures) {
{ area_id => 2482, categories => ['Lamp Column Damaged', 'Sign Light Not Working'], name => 'Bromley Council', cobrand => 'bromley' },
{ area_id => 164186, categories => ['Shelter Damaged', 'Very Urgent'], name => 'Northamptonshire Highways', cobrand => 'northamptonshire' },
{ area_id => 163793, categories => ['Flytipping', 'Roads', 'Parks', 'Snow and ice problem/winter salting'], name => 'Buckinghamshire Council', cobrand => 'buckinghamshire' },
{ area_id => 53822, categories => [ 'Grass cutting' ], name => 'Adstock Parish Council' }, # Buckinghamshire parish council
{ area_id => 2257, categories => ['Flytipping', 'Graffiti'], name => 'Chiltern District Council' },
{ area_id => 164186, categories => [ 'Graffiti' ], name => 'West Northamptonshire Council' },
{ area_id => 2483, categories => [ 'Potholes', 'Other' ], name => 'Hounslow Borough Council', cobrand => 'hounslow' },
Expand Down Expand Up @@ -244,6 +245,35 @@ if ($opt->test_fixtures) {
$child_cat->update;
}

$child_cat = FixMyStreet::DB->resultset("Contact")->find({
body => $bodies->{53822},
category => 'Grass cutting',
});
$child_cat->set_extra_fields({
code => 'speed_limit_greater_than_30',
description => 'Is the speed limit greater than 30mph?',
datatype => 'singlevaluelist',
order => 1,
variable => 'true',
required => 'true',
protected => 'false',
values => [
{
key => 'yes',
name => 'Yes',
},
{
key => 'no',
name => 'No',
},
{
key => 'dont_know',
name => "Don't know",
},
],
});
$child_cat->update;

$child_cat = FixMyStreet::DB->resultset("Contact")->find({
body => $bodies->{2483},
category => 'Other',
Expand Down
2 changes: 1 addition & 1 deletion t/Mock/MapIt.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ my @PLACES = (
[ 'BS10 5EE', 51.494885, -2.602237, 2561, 'Bristol City Council', 'UTA', 148646, 'Bedminster', 'UTW' ],
[ 'BS20 5EE', 51.496194, -2.603439, 2608, 'Borsetshire County Council', 'CTY', 148646, 'Bedminster', 'UTW' ],
[ 'SL9 0NX', 51.615559, -0.556903, 163793, 'Buckinghamshire Council', 'CTY', 2257, 'Chiltern District Council', 'DIS', 2796, 'Chalfont Common', 'DIW', 143422, 'Chalfont St Peter', 'CED', 53822, 'Adstock', 'CPC' ],
[ '?', 51.615499, -0.556667, 163793, 'Buckinghamshire Council', 'CTY', 2257, 'Chiltern District Council', 'DIS', 2796, 'Chalfont Common', 'DIW', 143422, 'Chalfont St Peter', 'CED' ],
[ '?', 51.615499, -0.556667, 163793, 'Buckinghamshire Council', 'CTY', 2257, 'Chiltern District Council', 'DIS', 2796, 'Chalfont Common', 'DIW', 143422, 'Chalfont St Peter', 'CED', 53822, 'Adstock', 'CPC' ],
[ '?', 51.615965, -0.556367, 163793, 'Buckinghamshire Council', 'CTY', 2257, 'Chiltern District Council', 'DIS', 2796, 'Chalfont Common', 'DIW', 143422, 'Chalfont St Peter', 'CED' ],
[ '?', 51.615439, -0.558362, 163793, 'Buckinghamshire Council', 'CTY', 2257, 'Chiltern District Council', 'DIS', 2796, 'Chalfont Common', 'DIW', 143422, 'Chalfont St Peter', 'CED' ],
[ 'HP19 8FF', 51.822364, -0.826409, 163793, 'Buckinghamshire Council', 'CTY', 2258, 'Aylesbury Vale District Council', 'DIS', 144545, 'Gatehouse', 'DIW', 143444, 'Aylesbury North-West', 'CED' ],
Expand Down
4 changes: 4 additions & 0 deletions templates/web/base/report/new/category_extras.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
<div class="extra-category-questions">
[% UNLESS category_extras_notices.$category %]
<h2 class="visuallyhidden form-section-heading">[% loc('Extra details') %]</h2>
[% TRY %]
[% INCLUDE 'report/new/_category_extras_header.html' %]
[% CATCH file %]
<p class="form-section-description">
[% tprintf(
loc('Help <strong>%s</strong> resolve your problem quicker, by providing some extra detail. This extra information will not be published online.'),
mark_safe(list_of_names.join( '</strong>' _ loc(' or ') _ '<strong>' ))
); %]
</p>
[% END %]
[% END %]
[% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$category %]
</div>
Expand Down
7 changes: 7 additions & 0 deletions templates/web/buckinghamshire/footer_extra_js.html
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
[% PROCESS 'footer_extra_js_base.html' highways=1 cobrand_js=1 validation=1 roadworks=1 %]
[%
IF bodyclass.match('mappage');
scripts.push(
version('/cobrands/buckinghamshire/grass_cutting.js')
);
END
%]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[% IF category == 'Grass cutting' %]
<p class="form-section-description">
Help us to direct your enquiry/report to the right team first time. Some services are provided by the Parish/Town Council, and are dependent on the location/road speed limit.
</p>
[% ELSE %]
[% THROW file 'Not found' %]
[% END %]
1 change: 1 addition & 0 deletions templates/web/fixmystreet.com/footer_extra_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
scripts.push( version('/cobrands/bristol/assets.js') );
scripts.push( version('/cobrands/bromley/assets.js') );
scripts.push( version('/cobrands/buckinghamshire/assets.js') );
scripts.push( version('/cobrands/buckinghamshire/grass_cutting.js') );
scripts.push( version('/cobrands/centralbedfordshire/assets.js') );
scripts.push( version('/cobrands/cheshireeast/assets.js') );
scripts.push( version('/cobrands/eastsussex/assets.js') );
Expand Down
31 changes: 31 additions & 0 deletions web/cobrands/buckinghamshire/grass_cutting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function(){

if (!fixmystreet.maps) {
return;
}

$(function() {
$(document).on('change', '#form_speed_limit_greater_than_30', function(e) {
var bucks, parish;
$.each(fixmystreet.bodies, function(i, body) {
if (body === 'Buckinghamshire Council') {
bucks = body;
} else {
parish = body;
}
});
if (!bucks || !parish) {
return;
}

if ($(this).val() === 'no') {
// Report for the parish
fixmystreet.update_public_councils_text($('#js-councils_text').html(), [parish]);
} else {
// Report for the council
fixmystreet.update_public_councils_text($('#js-councils_text').html(), [bucks]);
}
});
});

})();

0 comments on commit fa822e1

Please sign in to comment.