diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Triage.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Peterborough.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Contact.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Contact.pm | 23 | ||||
-rw-r--r-- | t/cobrand/bathnes.t | 3 | ||||
-rw-r--r-- | templates/web/base/report/new/category_extras.html | 2 | ||||
-rw-r--r-- | web/cobrands/borsetshire/base.scss | 4 | ||||
-rw-r--r-- | web/cobrands/buckinghamshire/assets.js | 1 |
12 files changed, 53 insertions, 17 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Triage.pm b/perllib/FixMyStreet/App/Controller/Admin/Triage.pm index 50d1b1437..0eabd340d 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Triage.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Triage.pm @@ -57,8 +57,7 @@ sub index : Path : Args(0) { my @categories = $c->stash->{body}->contacts->not_deleted->search( undef, { columns => [ 'id', 'category', 'extra' ], distinct => 1, - order_by => [ 'category' ], - } )->all; + } )->all_sorted; $c->stash->{filter_categories} = \@categories; $c->stash->{filter_category} = { map { $_ => 1 } $c->get_param_list('filter_category', 1) }; my $pins = $c->stash->{pins} || []; diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index f14d116cc..377449719 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -248,10 +248,9 @@ sub check_and_stash_category : Private { $where, { columns => [ 'category', 'extra' ], - order_by => [ 'category' ], distinct => 1 } - )->all; + )->all_sorted; $c->stash->{filter_categories} = \@categories; my %categories_mapped = map { $_->category => 1 } @categories; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 612c76c0c..8dec06e86 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -7,7 +7,6 @@ BEGIN { extends 'Catalyst::Controller'; } use Encode; use List::MoreUtils qw(uniq); use List::Util 'first'; -use POSIX 'strcoll'; use HTML::Entities; use Path::Class; use Utils; @@ -285,7 +284,7 @@ sub by_category_ajax_data : Private { if ( $c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1 ) { my $disable_form = $c->forward('disable_form_message'); - $body->{disable_form} = $disable_form if $disable_form; + $body->{disable_form} = $disable_form if %$disable_form; } my $unresponsive = $c->stash->{unresponsive}->{$category}; @@ -677,7 +676,7 @@ sub setup_categories_and_bodies : Private { ->model('DB::Contact') # ->active ->search( { 'me.body_id' => [ keys %bodies ] }, { prefetch => 'body' } ); - my @contacts = $c->cobrand->categories_restriction($contacts)->all; + my @contacts = $c->cobrand->categories_restriction($contacts)->all_sorted; # variables to populate my %bodies_to_list = (); # Bodies with categories assigned @@ -703,9 +702,6 @@ sub setup_categories_and_bodies : Private { $c->stash->{unresponsive}{$k} = { map { $_ => 1 } keys %bodies }; } - # keysort does not appear to obey locale so use strcoll (see i18n.t) - @contacts = sort { strcoll( $a->category, $b->category ) } @contacts; - my %seen; foreach my $contact (@contacts) { diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 85e647f65..271513df3 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -187,8 +187,7 @@ sub setup_categories_and_map :Private { my @categories = $c->stash->{body}->contacts->not_deleted->search( undef, { columns => [ 'id', 'category', 'extra', 'body_id', 'send_method' ], distinct => 1, - order_by => [ 'category' ], - } )->all; + } )->all_sorted; $c->cobrand->call_hook('munge_reports_category_list', \@categories); diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm index dd9bb0670..eb9208645 100644 --- a/perllib/FixMyStreet/Cobrand/Peterborough.pm +++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm @@ -13,6 +13,8 @@ sub council_area { 'Peterborough' } sub council_name { 'Peterborough City Council' } sub council_url { 'peterborough' } +sub send_questionnaires { 0 } + sub disambiguate_location { my $self = shift; my $string = shift; diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 6cbaa285b..6bbbdc775 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -334,9 +334,8 @@ sub report_page_data { my @categories = $c->model('DB::Contact')->not_deleted->search(undef, { columns => [ 'category', 'extra' ], - order_by => [ 'category' ], distinct => 1 - })->all; + })->all_sorted; $c->stash->{filter_categories} = \@categories; $c->stash->{filter_category} = { map { $_ => 1 } $c->get_param_list('filter_category', 1) }; diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index d8695683c..affc6d480 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -93,6 +93,21 @@ __PACKAGE__->many_to_many( response_templates => 'contact_response_templates', ' __PACKAGE__->many_to_many( response_priorities => 'contact_response_priorities', 'response_priority' ); __PACKAGE__->many_to_many( defect_types => 'contact_defect_types', 'defect_type' ); +__PACKAGE__->might_have( + "translations", + "FixMyStreet::DB::Result::Translation", + sub { + my $args = shift; + return { + "$args->{foreign_alias}.object_id" => { -ident => "$args->{self_alias}.id" }, + "$args->{foreign_alias}.tbl" => { '=' => \"?" }, + "$args->{foreign_alias}.col" => { '=' => \"?" }, + "$args->{foreign_alias}.lang" => { '=' => \"?" }, + }; + }, + { cascade_copy => 0, cascade_delete => 0 }, +); + sub category_display { my $self = shift; $self->get_extra_metadata('display_name') || $self->translate_column('category'); diff --git a/perllib/FixMyStreet/DB/ResultSet/Contact.pm b/perllib/FixMyStreet/DB/ResultSet/Contact.pm index 7b3258262..1643f9931 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Contact.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Contact.pm @@ -3,6 +3,7 @@ use base 'DBIx::Class::ResultSet'; use strict; use warnings; +use POSIX qw(strcoll); sub me { join('.', shift->current_source_alias, shift || q{}) } @@ -24,6 +25,28 @@ sub active { $rs->search( { $rs->me('state') => [ 'unconfirmed', 'confirmed' ] } ); } +sub translated { + my $rs = shift; + my $schema = $rs->result_source->schema; + $rs->search(undef, { + '+columns' => { 'msgstr' => 'translations.msgstr' }, + join => 'translations', + bind => [ 'category', $schema->lang, 'contact' ], + }); +} + +sub all_sorted { + my $rs = shift; + + my @contacts = $rs->translated->all; + @contacts = sort { + my $a_name = $a->get_extra_metadata('display_name') || $a->get_column('msgstr') || $a->category; + my $b_name = $b->get_extra_metadata('display_name') || $b->get_column('msgstr') || $b->category; + strcoll($a_name, $b_name) + } @contacts; + return @contacts; +} + sub summary_count { my ( $rs, $restriction ) = @_; diff --git a/t/cobrand/bathnes.t b/t/cobrand/bathnes.t index 42a8ffe93..006dd757d 100644 --- a/t/cobrand/bathnes.t +++ b/t/cobrand/bathnes.t @@ -72,8 +72,7 @@ subtest 'check override contact display name' => sub { 'extra[display_name]' => 'Wittering' }}); $mech->get_ok('/reports/Bath+and+North+East+Somerset'); - $mech->content_contains('Wittering</option>'); - $mech->content_contains('value="Litter"'); + $mech->content_like(qr/Traffic lights<\/option>\s*<option value="Litter">\s*Wittering<\/option>/); $mech->content_lacks('Litter</option>'); }; diff --git a/templates/web/base/report/new/category_extras.html b/templates/web/base/report/new/category_extras.html index 8e5b02952..0d8f20265 100644 --- a/templates/web/base/report/new/category_extras.html +++ b/templates/web/base/report/new/category_extras.html @@ -10,7 +10,7 @@ [%- IF category_extras.$category.size %] [% UNLESS category_extras_hidden.$category %] <div class="extra-category-questions"> - <h2 class="form-section-heading">[% category %]</h2> + <h2 class="visuallyhidden form-section-heading">[% loc('Extra details') %]</h2> <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.'), diff --git a/web/cobrands/borsetshire/base.scss b/web/cobrands/borsetshire/base.scss index 73e2e8f76..75ae7b143 100644 --- a/web/cobrands/borsetshire/base.scss +++ b/web/cobrands/borsetshire/base.scss @@ -116,4 +116,8 @@ body.authpage { } } +body.mappage .ms-header { + display: none; +} + @import "mysoc-header"; diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js index 74253448e..53198a0a9 100644 --- a/web/cobrands/buckinghamshire/assets.js +++ b/web/cobrands/buckinghamshire/assets.js @@ -192,6 +192,7 @@ var bucks_types = [ "3B", // HW: SECONDARY DISTRIBUTOR "4A", // HW: LINK ROAD "4B", // HW: LOCAL ACCESS ROAD + "9", // HW: NO CARRIAGEWAY "98", // HW: METALLED PUBLIC FOOTPATH "99" // HW: METALLED PUBLIC BRIDLEWAY ]; |