diff options
-rw-r--r-- | t/app/controller/report_new_open311.t | 25 | ||||
-rw-r--r-- | templates/web/base/report/new/category_extras.html | 1 | ||||
-rw-r--r-- | templates/web/base/report/new/councils_text.html | 1 | ||||
-rw-r--r-- | templates/web/base/report/new/councils_text_all.html | 1 | ||||
-rw-r--r-- | templates/web/base/report/new/councils_text_private.html | 1 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/new/councils_text_all.html | 1 | ||||
-rw-r--r-- | templates/web/tfl/report/new/councils_text_all.html | 1 | ||||
-rw-r--r-- | web/cobrands/bathnes/assets.js | 15 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 2 |
9 files changed, 44 insertions, 4 deletions
diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t index dcad10899..08435fb2b 100644 --- a/t/app/controller/report_new_open311.t +++ b/t/app/controller/report_new_open311.t @@ -360,6 +360,31 @@ subtest "Category extras includes description label for user" => sub { }; }; +subtest "Category extras are correct even if category has an ampersand in it" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + for ( + { url => '/report/new/ajax?' }, + { url => '/report/new/category_extras?category=Potholes+%26+Road+Defects' }, + ) { + my $category = "Potholes & Road Defects"; + $contact4->update({ category => $category }); + my $json = $mech->get_ok_json($_->{url} . '&latitude=55.952055&longitude=-3.189579'); + my $category_extra = $json->{by_category} ? $json->{by_category}{$category}{category_extra} : $json->{category_extra}; + contains_string($category_extra, "usrn") or diag $mech->content; + contains_string($category_extra, "central_asset_id"); + lacks_string($category_extra, "USRN", "Lacks 'USRN' label"); + lacks_string($category_extra, "Asset ID", "Lacks 'Asset ID' label"); + contains_string($category_extra, "Size?"); + lacks_string($category_extra, '<option value=""'); + contains_string($category_extra, "resolve your problem quicker, by providing some extra detail", "Contains description text"); + $contact4->update({ category => "Pothole" }); + } + }; +}; + subtest "Category extras includes form disabling string" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => 'fixmystreet', diff --git a/templates/web/base/report/new/category_extras.html b/templates/web/base/report/new/category_extras.html index 5cef391ce..9b4149119 100644 --- a/templates/web/base/report/new/category_extras.html +++ b/templates/web/base/report/new/category_extras.html @@ -1,5 +1,6 @@ [% SET default_list = [] %][% FOR b IN bodies_to_list.values %][% default_list.push(b.cobrand_name) %][% END %] [% DEFAULT list_of_names = default_list %] +[% category = mark_safe(category) %] <div id="category_meta"> [%- IF unresponsive.$category %] diff --git a/templates/web/base/report/new/councils_text.html b/templates/web/base/report/new/councils_text.html index 5f4b113ca..9b3d6fce7 100644 --- a/templates/web/base/report/new/councils_text.html +++ b/templates/web/base/report/new/councils_text.html @@ -1,4 +1,5 @@ [% FILTER collapse %] +[% category = mark_safe(category) %] [% IF unresponsive.$category OR unresponsive.ALL OR bodies_to_list.size == 0 %] [% tprintf( loc('These will be published online for others to see, in accordance with our <a href="%s">privacy policy</a>.'), diff --git a/templates/web/base/report/new/councils_text_all.html b/templates/web/base/report/new/councils_text_all.html index da512c980..08e27e8b3 100644 --- a/templates/web/base/report/new/councils_text_all.html +++ b/templates/web/base/report/new/councils_text_all.html @@ -1,5 +1,6 @@ [% SET default_list = [] %][% FOR b IN bodies_to_list.values %][% default_list.push(b.cobrand_name) %][% END %] [% DEFAULT list_of_names = default_list %] +[% category = mark_safe(category) %] <p> [% UNLESS non_public_categories.$category; diff --git a/templates/web/base/report/new/councils_text_private.html b/templates/web/base/report/new/councils_text_private.html index cab38c97e..80bcfed74 100644 --- a/templates/web/base/report/new/councils_text_private.html +++ b/templates/web/base/report/new/councils_text_private.html @@ -1,4 +1,5 @@ [% FILTER collapse %] +[% category = mark_safe(category) %] [% IF unresponsive.$category OR unresponsive.ALL OR bodies_to_list.size == 0 %] [% loc('These details will never be shown online without your permission.') %] [% ELSE %] diff --git a/templates/web/oxfordshire/report/new/councils_text_all.html b/templates/web/oxfordshire/report/new/councils_text_all.html index 08852a772..38459b059 100644 --- a/templates/web/oxfordshire/report/new/councils_text_all.html +++ b/templates/web/oxfordshire/report/new/councils_text_all.html @@ -1,3 +1,4 @@ +[% category = mark_safe(category) %] <p> All the information you provide here will be sent to the [% # NB this empty class attribute is so fixmystreet.update_public_councils_text diff --git a/templates/web/tfl/report/new/councils_text_all.html b/templates/web/tfl/report/new/councils_text_all.html index 22e130347..ae9fb3307 100644 --- a/templates/web/tfl/report/new/councils_text_all.html +++ b/templates/web/tfl/report/new/councils_text_all.html @@ -1,4 +1,5 @@ <p> +[% category = mark_safe(category) %] [% UNLESS non_public_categories.$category; tprintf( diff --git a/web/cobrands/bathnes/assets.js b/web/cobrands/bathnes/assets.js index f508ca97c..fb31749f2 100644 --- a/web/cobrands/bathnes/assets.js +++ b/web/cobrands/bathnes/assets.js @@ -207,15 +207,24 @@ fixmystreet.assets.add(fixmystreet.maps.banes_defaults, { all_categories: true, // Not really, but want to allow on all but one, not stop no_asset_msg_id: '#js-not-a-road', cat_map: { + 'Blocked drain surface': 'road', + 'Blocked drain': 'road', 'Damage to pavement': 'pavement', - 'Damage to road': 'road' + 'Damage to road': 'road', + 'Damaged Railing, manhole, or drain cover': 'road', + 'Damaged bollard or post': 'road', + 'Damaged road sign': 'road', + 'Damaged street nameplate': 'road', + 'Faded road markings': 'road', + 'Flooding of a road or pavement': 'road' }, actions: { found: fixmystreet.message_controller.road_found, not_found: function(layer) { var cat = $('select#form_category').val(); - if (cat === 'Damage to pavement' || cat === 'Damage to road') { - layer.fixmystreet.asset_item = layer.fixmystreet.cat_map[cat]; + var asset_item = layer.fixmystreet.cat_map[cat]; + if (asset_item) { + layer.fixmystreet.asset_item = asset_item; fixmystreet.message_controller.road_not_found(layer); } else { fixmystreet.message_controller.road_found(layer); diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index adb935708..32eb24a8b 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -453,7 +453,7 @@ $.extend(fixmystreet.set_up, { } if (data && data.non_public) { $(".js-hide-if-private-category").hide(); - $(".js-hide-if-public-category").show(); + $(".js-hide-if-public-category").removeClass("hidden-js").show(); } else { $(".js-hide-if-private-category").show(); $(".js-hide-if-public-category").hide(); |