diff options
22 files changed, 392 insertions, 104 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 900addd20..66a1b69c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,10 +44,12 @@ - Bulk user import admin page. #2057 - Add link to admin edit page for reports. #2071 - Nicer Open311 errors. #2078 + - Deleted body categories now hidden by default #1962 - Development improvements: - Add HTML email previewer. - Add CORS header to Open311 output. #2022 - Add some Cypress browser-based testing. + - Upgrade Vagrantfile to use Ubuntu Xenial. #2093 - Add validation to cobrand-specific custom reporting fields. * v2.3.1 (12th February 2018) diff --git a/Vagrantfile b/Vagrantfile index b3647ad2b..c2ad471a2 100755..100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,9 +1,6 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -BOX_NAME = ENV['BOX_NAME'] || "precise64" -BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64.box" - # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" @@ -13,11 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # please see the online documentation at vagrantup.com. # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = BOX_NAME - - # The url from where the 'config.vm.box' box will be fetched if it - # doesn't already exist on the user's system. - config.vm.box_url = BOX_URI + config.vm.box = "ubuntu/xenial64" # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 1646bc4d5..e36085d05 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -426,7 +426,7 @@ sub inspect : Private { cobrand_data => $problem->cobrand_data, lang => $problem->lang, }; - $problem->user->create_alert($problem->id, $options); + $c->user->create_alert($problem->id, $options); } # If the state has been changed to action scheduled and they've said diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm index e1c119cfb..a1ba25e6c 100644 --- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm +++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm @@ -322,7 +322,7 @@ sub lookup_site_code { my $self = shift; my $row = shift; - my $buffer = 5; # metres + my $buffer = 10; # metres my ($x, $y) = $row->local_coords; my ($w, $s, $e, $n) = ($x-$buffer, $y-$buffer, $x+$buffer, $y+$buffer); diff --git a/perllib/FixMyStreet/Cobrand/Rutland.pm b/perllib/FixMyStreet/Cobrand/Rutland.pm index c0f9dd197..2e4d434b5 100644 --- a/perllib/FixMyStreet/Cobrand/Rutland.pm +++ b/perllib/FixMyStreet/Cobrand/Rutland.pm @@ -43,4 +43,13 @@ sub pin_colour { return 'green' if $p->is_fixed || $p->is_closed; return 'yellow'; } + +sub send_questionnaires { + return 0; +} + +sub ask_ever_reported { + return 0; +} + 1; diff --git a/perllib/Open311.pm b/perllib/Open311.pm index a65e19fa6..dc40076db 100644 --- a/perllib/Open311.pm +++ b/perllib/Open311.pm @@ -126,7 +126,7 @@ sub _populate_service_request_params { $description = $problem->detail; } - my ( $firstname, $lastname ) = ( $problem->name =~ /(\w+)\.?\s+(.+)/ ); + my ( $firstname, $lastname ) = $self->split_name( $problem->name ); my $params = { description => $description, @@ -338,7 +338,7 @@ sub _populate_service_request_update_params { my $comment = shift; my $name = $comment->name || $comment->user->name; - my ( $firstname, $lastname ) = ( $name =~ /(\w+)\.?\s+(.+)/ ); + my ( $firstname, $lastname ) = $self->split_name( $name ); $lastname ||= '-'; # fall back to problem state as it's probably correct @@ -410,6 +410,29 @@ sub _populate_service_request_update_params { return $params; } +sub split_name { + my ( $self, $name ) = @_; + + my ( $first, $last ) = ( $name =~ /(\w+)(?:\.?\s+(.+))?/ ); + + return ( $first, $last ); +} + +sub _params_to_string { + my( $self, $params, $request_string ) = @_; + + my $undefined; + + my $string = join("\n", map { + $undefined .= "$_ undefined\n" unless defined $params->{$_}; + "$_: " . ( $params->{$_} // '' ); + } keys %$params); + + warn "$request_string $undefined $string" if $undefined; + + return $string; +} + sub _get { my $self = shift; my $path = shift; @@ -424,7 +447,7 @@ sub _get { $uri->query_form( $params ); my $debug_request = "GET " . $base_uri->as_string . "\n\n"; - $debug_request .= join("\n", map { "$_: $params->{$_}" } keys %$params); + $debug_request .= $self->_params_to_string($params, $debug_request); $self->debug_details( $self->debug_details . $debug_request ); my $content; @@ -472,7 +495,7 @@ sub _post { my $req = POST $uri->as_string, $params; my $debug_request = $req->method . ' ' . $uri->as_string . "\n\n"; - $debug_request .= join("\n", map { "$_: $params->{$_}" } keys %$params); + $debug_request .= $self->_params_to_string($params, $debug_request); $self->debug_details( $self->debug_details . $debug_request ); my $ua = LWP::UserAgent->new(); diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index b3b165d27..e052e4bd4 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -110,13 +110,18 @@ sub update_comments { if ( !$c->first ) { my $state = $open311->map_state( $request->{status} ); - my $external_status_code = $request->{external_status_code}; + my $old_state = $p->state; + my $external_status_code = $request->{external_status_code} || ''; + my $old_external_status_code = $p->get_extra_metadata('external_status_code') || ''; my $comment = $self->schema->resultset('Comment')->new( { problem => $p, user => $self->system_user, external_id => $request->{update_id}, - text => $self->comment_text_for_request($request, $p, $state, $external_status_code), + text => $self->comment_text_for_request( + $request, $p, $state, $old_state, + $external_status_code, $old_external_status_code + ), mark_fixed => 0, mark_open => 0, anonymous => 0, @@ -184,22 +189,28 @@ sub update_comments { } sub comment_text_for_request { - my ($self, $request, $problem, $state, $external_status_code) = @_; + my ($self, $request, $problem, $state, $old_state, + $ext_code, $old_ext_code) = @_; return $request->{description} if $request->{description}; - my $state_params = { - 'me.state' => $state - }; - if ($external_status_code) { - $state_params->{'me.external_status_code'} = $external_status_code; - }; - - if (my $template = $problem->response_templates->search({ - auto_response => 1, - -or => $state_params, - })->first) { - return $template->text; + # Response templates are only triggered if the state/external status has changed + my $state_changed = $state ne $old_state; + my $ext_code_changed = $ext_code ne $old_ext_code; + if ($state_changed || $ext_code_changed) { + my $state_params = { + 'me.state' => $state + }; + if ($ext_code) { + $state_params->{'me.external_status_code'} = $ext_code; + }; + + if (my $template = $problem->response_templates->search({ + auto_response => 1, + -or => $state_params, + })->first) { + return $template->text; + } } return "" if $self->blank_updates_permitted; diff --git a/perllib/Open311/GetServiceRequests.pm b/perllib/Open311/GetServiceRequests.pm index 48e35acab..2d15347fd 100644 --- a/perllib/Open311/GetServiceRequests.pm +++ b/perllib/Open311/GetServiceRequests.pm @@ -127,7 +127,8 @@ sub create_problems { $updated_time->clone->set_time_zone('UTC') ); if ($args->{start_date} && $args->{end_date} && ($updated lt $args->{start_date} || $updated gt $args->{end_date}) ) { - warn "Problem id $request_id for @{[$body->name]} has an invalid time, not creating" + warn "Problem id $request_id for @{[$body->name]} has an invalid time, not creating: " + . "$updated either less than $args->{start_date} or greater than $args->{end_date}" if $self->verbose; next; } @@ -6,9 +6,20 @@ use warnings; my $root; BEGIN { - use File::Basename qw(dirname); - use File::Spec; - $root = dirname(File::Spec->rel2abs(__FILE__)); + use Cwd qw(abs_path); + use File::Basename qw(dirname basename); + $root = dirname(abs_path(__FILE__)); +} + +# Check there is not a later timestamped deploy, if running in such a system + +if ($root =~ /fixmystreet-\d\d\d\d-\d\d-\d\dT\d\d-\d\d-\d\d$/) { + my @deploys = sort map { basename $_ } glob("$root/../fixmystreet-*"); + if (basename($root) ne $deploys[-1] && !$ENV{OLD_DEPLOY_ACKNOWLEDGED}) { + require Term::ANSIColor; + print Term::ANSIColor::colored("NOT THE LATEST DEPLOY; ABORTING\n", 'red'); + exit 1; + } } # Set the environment for the FixMyStreet project @@ -68,7 +79,7 @@ else { my @modules = sort - grep { m/File::/ } + grep { m/Cwd|File::(?!Glob)/ } map { s{\.pm$}{}; s{/}{::}g; $_ } grep { m{\.pm$} } keys %INC; diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index f2b300e11..6a001225d 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -36,8 +36,8 @@ my $report_id = $report->id; my $report2_id = $report2->id; my $report3_id = $report3->id; - -my $user = $mech->log_in_ok('test@example.com'); +$mech->create_user_ok('body@example.com', name => 'Body User'); +my $user = $mech->log_in_ok('body@example.com'); $user->set_extra_metadata('categories', [ $contact->id ]); $user->update( { from_body => $oxon } ); diff --git a/t/open311.t b/t/open311.t index 35d9b0ecb..4dc1b2959 100644 --- a/t/open311.t +++ b/t/open311.t @@ -133,8 +133,38 @@ for my $test ( } ], params => [ - [ 'attribute[title]', 'A title', 'extra paramater used correctly' ] - ] + [ 'attribute[title]', 'A title', 'extra parameter used correctly' ] + ], + debug_contains => 'attribute\[title\]: A title', + }, + { + desc => 'undef extra values handled', + extra => [ + { + name => 'title', + value => undef, + } + ], + params => [ + [ 'attribute[title]', '', 'undef extra parameter used correctly' ] + ], + # multi line warnings are not handled well so just match the + # first line + warning => qr/POST requests.xml/, + debug_contains => 'attribute\[title\]: $', + }, + { + desc => '0 extra values handled', + extra => [ + { + name => 'title', + value => 0, + } + ], + params => [ + [ 'attribute[title]', '0', '0 extra parameter used correctly' ] + ], + debug_contains => 'attribute\[title\]: 0', }, { desc => 'first and last names in extra used correctly', @@ -178,11 +208,24 @@ for my $test ( my $extra = { url => 'http://example.com/report/1', }; - my $results = make_service_req( $problem, $extra, $problem->category, -'<?xml version="1.0" encoding="utf-8"?><service_requests><request><service_request_id>248</service_request_id></request></service_requests>' - ); + my $results; + if ( $test->{warning} ) { + warnings_exist { + $results = make_service_req( $problem, $extra, $problem->category, + '<?xml version="1.0" encoding="utf-8"?><service_requests><request><service_request_id>248</service_request_id></request></service_requests>' + ); + } [ $test->{warning} ], 'warning generated by service request call'; + } else { + $results = make_service_req( $problem, $extra, $problem->category, + '<?xml version="1.0" encoding="utf-8"?><service_requests><request><service_request_id>248</service_request_id></request></service_requests>' + ); + } my $c = CGI::Simple->new( $results->{req}->content ); + if ( $test->{debug_contains} ) { + like $results->{o}->debug_details, qr/$test->{debug_contains}/m, 'extra handled correctly in debug'; + } + for my $param ( @{ $test->{params} } ) { is $c->param( $param->[0] ), $param->[1], $param->[2]; } @@ -196,6 +239,12 @@ for my $test ( first_name => 'Nom', last_name => 'de Report', }, + { + desc => 'Check single word name handled correctly', + name => 'Nom', + first_name => 'Nom', + last_name => '', + } ) { subtest $test->{desc} => sub { $problem->extra( undef ); @@ -756,5 +805,5 @@ sub _make_req { my $req = $o->test_req_used; - return { res => $res, req => $req }; + return { res => $res, req => $req, o => $o }; } diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index cc319cbdc..dad3bb0d1 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -358,6 +358,18 @@ for my $test ( end_state => 'investigating', }, { + desc => 'unchanging state does not trigger auto-response template', + description => '', + xml_description => '', + external_id => 638344, + start_state => 'investigating', + comment_status => 'INVESTIGATING', + mark_fixed => 0, + mark_open => 0, + problem_state => 'investigating', + end_state => 'investigating', + }, + { desc => 'open status does not re-open hidden report', description => 'This is a note', external_id => 638344, @@ -689,7 +701,7 @@ subtest 'check that external_status_code is stored correctly' => sub { $problem->discard_changes; is $problem->comments->count, 2, 'two comments after fetching updates'; - my @comments = $problem->comments->all; + my @comments = $problem->comments->search(undef, { order_by => [ 'created' ] } )->all; is $comments[0]->get_extra_metadata('external_status_code'), "060", "correct external status code on first comment"; is $comments[1]->get_extra_metadata('external_status_code'), "101", "correct external status code on second comment"; diff --git a/templates/web/base/report/new/category_extras_fields.html b/templates/web/base/report/new/category_extras_fields.html index cf5cc37b4..c4456d04e 100644 --- a/templates/web/base/report/new/category_extras_fields.html +++ b/templates/web/base/report/new/category_extras_fields.html @@ -8,6 +8,7 @@ [% ELSIF meta.variable != 'false' || NOT hide_notices %] <label for="[% cat_prefix %]form_[% meta_name %]">[% meta.description %]</label> + [% TRY %][% INCLUDE 'report/new/_category_extra_field_notice.html' %][% CATCH file %][% END %] [% IF field_errors.$meta_name %] <p class='form-error'>[% field_errors.$meta_name %]</p> [% END -%] diff --git a/templates/web/buckinghamshire/report/new/councils_extra_text.html b/templates/web/buckinghamshire/report/new/councils_extra_text.html index 0b3246472..16aed5154 100644 --- a/templates/web/buckinghamshire/report/new/councils_extra_text.html +++ b/templates/web/buckinghamshire/report/new/councils_extra_text.html @@ -1,8 +1 @@ -<p> -<strong>IMPORTANT:</strong> -If you consider this to be dangerous or an emergency, please call us -on: <strong>01296 382416</strong> (09:00 – 17:30 Mon-Thurs, 09:00 – 17:00 Friday) -or <strong>01296 486630</strong> -(out of hours and weekends). Otherwise, by submitting the report online we will -deal with it in line with our agreed timescales. -</p> +Please do not enter any personal information or private contact details. diff --git a/templates/web/buckinghamshire/report/new/form_heading.html b/templates/web/buckinghamshire/report/new/form_heading.html new file mode 100644 index 000000000..0b3246472 --- /dev/null +++ b/templates/web/buckinghamshire/report/new/form_heading.html @@ -0,0 +1,8 @@ +<p> +<strong>IMPORTANT:</strong> +If you consider this to be dangerous or an emergency, please call us +on: <strong>01296 382416</strong> (09:00 – 17:30 Mon-Thurs, 09:00 – 17:00 Friday) +or <strong>01296 486630</strong> +(out of hours and weekends). Otherwise, by submitting the report online we will +deal with it in line with our agreed timescales. +</p> diff --git a/templates/web/fixmystreet.com/header.html b/templates/web/fixmystreet.com/header.html deleted file mode 100644 index a1f66945d..000000000 --- a/templates/web/fixmystreet.com/header.html +++ /dev/null @@ -1,43 +0,0 @@ -[% - SET html_att = ' lang="' _ lang_code _ '"'; - # For a right-to-left language, use the following line in your own header: - # SET html_att = html_att _ ' dir="rtl"'; --%] -<!doctype html> -<!--[if IE 7]> <html class="no-js ie7 iel8"[% html_att %]><![endif]--> -<!--[if IE 8]> <html class="no-js ie8 iel8"[% html_att %]><![endif]--> -<!--[if IE 9]> <html class="no-js ie9"[% html_att %]><![endif]--> -<!--[if gt IE 9]><!--><html class="no-js"[% html_att %] -[% IF appcache ~%] - manifest="/offline/appcache.manifest" -[%~ END %]><!--<![endif]--> - <head> - <meta name="viewport" content="initial-scale=1.0"> - - <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> - <meta name="HandHeldFriendly" content="true"> - <meta name="mobileoptimized" content="0"> - - [% INCLUDE 'header_opengraph.html' %] - [% INCLUDE 'header/css.html' %] - [% INCLUDE 'common_header_tags.html' %] - [% TRY %][% PROCESS 'header_extra.html' %][% CATCH file %][% END %] - - </head> - [% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %] - <body class="[% bodyclass | html IF bodyclass %]"> - <div class="top_banner top_banner--donate"><p> - <strong>Help keep our sites running in 2018.</strong> - <a href="https://www.mysociety.org/donate/">Please donate today</a>. - </p></div> - - <div class="wrapper"> - <div class="table-cell"> - [% INCLUDE 'header_site.html' %] - - [% pre_container_extra %] - - <div class="container"> - <div class="content[% " $mainclass" | html IF mainclass %]" role="main"> - - <!-- [% INCLUDE 'debug_header.html' %] --> diff --git a/templates/web/rutland/about/faq-en-gb.html b/templates/web/rutland/about/faq-en-gb.html new file mode 100644 index 000000000..cfe1d9153 --- /dev/null +++ b/templates/web/rutland/about/faq-en-gb.html @@ -0,0 +1,172 @@ +[% INCLUDE 'header.html', title => loc('Frequently Asked Questions'), bodyclass => 'twothirdswidthpage' %] + +<div class="sticky-sidebar"> + <aside> + <ul class="plain-list"> + <li><strong>Frequently Asked Questions</strong</li> + <li><a href="/privacy">Privacy and cookies</a></li> + <li><a href="https://www.rutland.gov.uk/my-council/contact-us/">Contact Rutland County Council</a></li> + </ul> + </aside> +</div> + +<h1><a name="faq"></a>Frequently Asked Questions</h1> +<dl> + <dt>How can I report a pothole, street or road problem?</dt> + <dd> + <p> + This easy to use web site is designed to help Rutland residents to report, + view, or discuss local highway faults, including potholes, directly and quickly + to us by simply locating them on a map. You can do this by using your computer + or your mobile phone. + </p> + <p> + Please report one problem at a time; you will be given an opportunity at the end + to report another problem using the personal details previously entered. + </p> + </dd> + + <dt>What sort of problems can I report?</dt> + <dd> + <p> + You can report faults linked to amenities or problems that are broken or dirty, + damaged or dumped, or need fixing, cleaning or clearing such as: + </p> + <ul> + <li>Abandoned vehicles + <li>Dog Fouling + <li>Flyposting or graffiti + <li>Flytipping or litter + <li>Streetcleaning, such as broken glass in a cycle lane + <li>Unlit lampposts + <li>Potholes + </ul> + </dd> + <dt>What isn’t it for?</dt> + <dd> + <p> + The web site is not a way of getting in touch with the council for all issues + — please use it only for problems highlighted above. + </p> + <p> + As we often route problems via our cleansing services or highways departments, + using the site for other matters may result in a delay in your report getting + to the right people. + </p> + <div style="margin-left:1.5em;"> + <p> + <strong>You will need to contact the county council directly for</strong>: + </p> + <ul> + <li>Any urgent or emergency problems + <li>Complaining about the council + <li>Proposals for speed bumps/ CCTV/ pedestrian crossings/ new road layouts/ etc. + </ul> + </div> + </dd> + + <dt>How do I use the reporting tool on the site?</dt> + <dd> + <p> + After entering a postcode or location, you will then be presented with a map of + that area. You can then view problems already reported in that area, or report new + ones of your own simply by clicking on the map at the location of the problem. + </p> + </dd> + + <dt>How are the problems solved?</dt> + <dd> + <p> + They are reported to us automatically. We then resolve the problem the way we + normally would and update the fault on the map. + </p> + </dd> + + <dt>What does the map show?</dt> + <dd> + <p> + The map shows all faults submitted online. You can view the exact location of + each fault and see its current status. + </p> + </dd> + + <dt>What updates will I receive?</dt> + <dd> + <p> + When you record a fault you can sign up to receive updates and you will + receive an initial email to acknowledge the report. + </p> + <p> + You will then receive an email every time that fault is updated. This could be when + a member of the public posts an update onto the fault or when we post a status update. + </p> + <p> + Road problems that are the responsibility of our Highways department, such as potholes, + will receive automatic updates at different stages. You will receive an email when the + problem has been inspected and another one when the fault is fixed. + </p> + <p> + Some faults may be marked as referred when they are not the responsibility of Rutland County Council. + </p> + <p> + All of these updates will also be posted on the mapped fault so that anyone can see the status of any + fault recorded by clicking on it on the map. + </p> + </dd> + + <dt>How can I get an update on a fault?</dt> + <dd> + <p> + When you record a fault you can sign up to receive updates. You will then receive an initial + email to acknowledge the report. In time, you will receive a further email when the problem is + assigned for inspection, one if the problem needs to be referred to another department or + organisation, and a final email when it is fixed or requires no further work. + </p> + <p> + These updates will also be posted on the mapped fault so that anyone can see the status of + any fault recorded by clicking on it on the map. + </p> + </dd> + + <dt>Can I report a fault on my mobile?</dt> + <dd> + <p> + Yes, you can view our website on your phone or tablet and it will automatically adapt to the + size of your screen. + </p> + </dd> +</dl> + +<dl> + <dt>Inappropriate use</dt> + <dd> + <p> + Rutland County Council is not responsible for the content and + accuracy of material submitted by its users. Rutland County Council will monitor + this website for instances of inappropriate use, and reserves the right to moderate + comments if such instances occur. + </p> + </dd> + + <dt>Why does the site use kilometres for measurements?</dt> + <dd> + <p> + The maps are from Ordnance Survey who based their grid reference + system on measurements in metres and kilometres. + </p> + </dd> + + <dt>How do I report a fault outside of Rutland?</dt> + <dd> + <p> + The map only shows locations within Rutland to keep it locally focussed. + </p> + </dd> +</dl> + +<p> + You can find out more about FixMyStreet at <a href="https://www.fixmystreet.com">www.fixmystreet.com</a>. +</p> +<p> <p> + +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/web/cobrands/fixmystreet/admin.js b/web/cobrands/fixmystreet/admin.js index f5ae082c0..d1a75a6dc 100644 --- a/web/cobrands/fixmystreet/admin.js +++ b/web/cobrands/fixmystreet/admin.js @@ -51,7 +51,7 @@ $(function(){ // on a body's page, hide/show deleted contact categories var $table_with_deleted_contacts = $('table tr.is-deleted td.contact-category').closest('table'); if ($table_with_deleted_contacts.length == 1) { - var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Hide deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>"); + var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Show deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>"); $table_with_deleted_contacts.before($toggle_deleted_btn); $toggle_deleted_btn.on('click', function(e){ e.preventDefault(); diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index 57c82a46b..9a72590fd 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -1,5 +1,21 @@ var fixmystreet = fixmystreet || {}; +(function(){ + // Retrieves the latitude/longitude from <inputs> + // on the page and returns it as a LonLat in the + // same projection as the map. + fixmystreet.get_lonlat_from_dom = function() { + var lonlat = new OpenLayers.LonLat( + $('input[name="longitude"]').val(), + $('input[name="latitude"]').val() + ); + return lonlat.clone().transform( + new OpenLayers.Projection("EPSG:4326"), + fixmystreet.map.getProjectionObject() + ); + }; +})(); + /* Special USRN handling */ (function(){ @@ -35,6 +51,17 @@ fixmystreet.usrn = { update_field: function() { $("input[name="+usrn_field+"]").val(selected_usrn); + }, + + one_time_select: function() { + // This function takes the current report lat/lon from hidden input + // fields and uses that to look up a USRN from the USRN layer. + // It's registered as an event handler by init_asset_layer below, + // and is only intended to run the once (because if the user drags the + // pin the usual USRN lookup event handler is run) so unregisters itself + // immediately. + this.events.unregister( 'loadend', this, fixmystreet.usrn.one_time_select ); + fixmystreet.usrn.select(null, fixmystreet.get_lonlat_from_dom()); } }; @@ -58,15 +85,7 @@ fixmystreet.roads = { // on a cobrand with category groups enabled. return; } - var lonlat = new OpenLayers.LonLat( - $('input[name="longitude"]').val(), - $('input[name="latitude"]').val() - ); - var transformedLonlat = lonlat.clone().transform( - new OpenLayers.Projection("EPSG:4326"), - fixmystreet.map.getProjectionObject() - ); - fixmystreet.roads.check_for_road(transformedLonlat); + fixmystreet.roads.check_for_road(fixmystreet.get_lonlat_from_dom()); }, select: function(evt, lonlat) { @@ -157,6 +176,19 @@ function init_asset_layer(layer, pins_layer) { layer.fixmystreet.fault_layer.setZIndex(layer.getZIndex()-1); } + if (fixmystreet.page == 'new' && layer.fixmystreet.usrn) { + // If the user visits /report/new directly and doesn't change the pin + // location, then the assets:selected/maps:update_pin events are never + // fired and fixmystreet.usrn.select is never called. This results in a + // report whose location was never looked up against the USRN layer, + // which can cause issues for Open311 endpoints that require a USRN + // value. + // To prevent this situation we register an event handler that looks up + // the new report's lat/lon against the USRN layer, calls usrn.select + // and then unregisters itself. + layer.events.register( 'loadend', layer, fixmystreet.usrn.one_time_select ); + } + if (!layer.fixmystreet.always_visible) { // Show/hide the asset layer when the category is chosen $("#problem_form").on("change.category", "select#form_category", function(){ diff --git a/web/cobrands/fixmystreet/images/fms-platform-logo-dark.svg b/web/cobrands/fixmystreet/images/fms-platform-logo-dark.svg new file mode 100644 index 000000000..f912aea71 --- /dev/null +++ b/web/cobrands/fixmystreet/images/fms-platform-logo-dark.svg @@ -0,0 +1 @@ +<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 445.8 50"><g><g><g fill="#000000"><path d="M66.1 13.6h-2.6v-2.5h15c1.7 0 2.4.7 2.4 2.4v2.8h-2.6v-1.9c0-.6-.3-.9-.9-.9h-8.5v10.5h10.2v2.5h-10.2v12.5h-2.8v-25.4zM85.5 22.3c0-.6-.3-.9-.9-.9h-1.7v-2.3h2.8c1.7 0 2.4.7 2.4 2.4v14.4c0 .6.3.9.9.9h1.7v2.3h-2.8c-1.7 0-2.4-.7-2.4-2.4v-14.4zm-.1-11.2h2.6v3.4h-2.6v-3.4zM99.6 28.7l-4.4-6.4c-.5-.7-1-.8-1.8-.8h-.8v-2.3h1.4c2 0 2.6.3 3.8 2.2l2.9 4.5c.3.5.7 1.2.7 1.2h.1s.4-.7.6-1.2l2.9-4.5c1.2-1.8 1.7-2.2 3.8-2.2h1.4v2.3h-.8c-.8 0-1.4.1-1.9.8l-4.4 6.4 7.1 10.4h-3.2l-4.9-7.4c-.3-.5-.6-1.1-.6-1.1h-.1s-.3.6-.7 1.1l-4.9 7.4h-3.2l7-10.4zM111.8 36.6h1.5c.6 0 .8-.3.9-.9l2-24.6h2.8l7.5 16.3c.7 1.4 1.4 3.3 1.4 3.3h.1s.7-1.9 1.4-3.3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.1.1v2.7s-.5-.1-1-.1c-2.9 0-5 2.3-5.9 5.2-.4 1.3-.6 2.7-.6 4v8.5h-2.7v-16.9zM412.6 22.9c0-.6-.3-.9-.9-.9h-1.7v-2.4h2.8c1.7 0 2.5.7 2.5 2.3v.9c0 .8-.1 1.5-.1 1.5h.1c1-2.7 4.2-5.1 7.3-5.1 3.8 0 5.7 1.7 6.3 5.1h.1c1.1-2.7 4-5.1 7.5-5.1 4.9 0 6.7 2.9 6.7 7.9v9.6c0 .6.3.9.9.9h1.7v2.4h-2.8c-1.7 0-2.5-.7-2.5-2.5v-9.8c0-3.3-.7-6-4.4-6-3.1 0-5.6 2.7-6.4 5.7-.3.9-.4 1.9-.4 2.9v9.6h-2.7v-12.2c0-3.1-.4-6-4.3-6-3.3 0-5.8 2.9-6.6 6-.2.8-.3 1.8-.3 2.7v9.6h-2.7v-17.1z"/></g></g></g></svg> diff --git a/web/cobrands/rutland/layout.scss b/web/cobrands/rutland/layout.scss index eb0447be2..168d31fba 100755 --- a/web/cobrands/rutland/layout.scss +++ b/web/cobrands/rutland/layout.scss @@ -13,3 +13,12 @@ body.frontpage #site-logo { height: 100px; width: 220px; } + + +body.fullwidthpage, body.twothirdswidthpage { + .container .content footer { + a.platform-logo { + background-image: url(/cobrands/fixmystreet/images/fms-platform-logo-dark.svg); + } + } +} diff --git a/web/cobrands/sass/_admin.scss b/web/cobrands/sass/_admin.scss index bf96dd08f..9b4f8e20f 100644 --- a/web/cobrands/sass/_admin.scss +++ b/web/cobrands/sass/_admin.scss @@ -69,6 +69,10 @@ $button_bg_col: #a1a1a1; // also search bar (tables) } } +.js tr.is-deleted { + display: none; +} + .admin-box { // for delimiting forms, etc border:1px solid #999; padding:0.5em 1em; |