aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2015-07-28 16:45:25 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2015-07-28 16:45:25 +0100
commitaaa1947c2ec5a45cfca0b01213464afcc10e4c9a (patch)
tree83f708393670602834a377dddbb0629dfa8bd9d6
parent77a343a8d148abc4eb8922b645b25eefe0fae8c9 (diff)
parent9d00e9bc88bde0c604a30d7f72890768b13ee7f0 (diff)
Merge branch 'issues/968-refusing-councils'
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm42
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Static.pm19
-rw-r--r--perllib/FixMyStreet/SendReport/Refused.pm7
-rw-r--r--t/app/controller/report_new.t100
-rw-r--r--t/app/controller/report_new_open311.t2
-rw-r--r--templates/web/base/report/new/category.html2
-rw-r--r--templates/web/base/report/new/category_extras.html7
-rw-r--r--templates/web/base/report/new/category_wrapper.html17
-rw-r--r--templates/web/base/report/new/councils_text.html4
-rw-r--r--templates/web/base/report/new/fill_in_details_form.html21
-rw-r--r--templates/web/bromley/report/new/fill_in_details_form.html19
-rw-r--r--templates/web/eastsussex/report/new/category.html2
-rw-r--r--templates/web/emptyhomes/report/new/fill_in_details_form.html17
-rw-r--r--templates/web/fixmystreet.com/report/new/category_at_top.html1
-rw-r--r--templates/web/fixmystreet.com/report/new/unresponsive_body.html12
-rw-r--r--templates/web/fixmystreet.com/static/unresponsive.html38
-rw-r--r--templates/web/fixmystreet/report/new/fill_in_details_form.html26
-rw-r--r--templates/web/seesomething/report/new/category.html2
-rw-r--r--templates/web/zurich/report/new/fill_in_details_form.html19
-rw-r--r--web/cobrands/fixmystreet/base.scss76
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js13
-rw-r--r--web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow.pngbin0 -> 253 bytes
-rw-r--r--web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow@2.pngbin0 -> 332 bytes
-rw-r--r--web/cobrands/fixmystreet/layout.scss51
-rw-r--r--web/cobrands/sass/_base.scss17
-rw-r--r--web/js/map-OpenLayers.js10
27 files changed, 403 insertions, 123 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 91d6be4fb..114a2e19f 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -342,7 +342,7 @@ sub update_contacts : Private {
my $category = $self->trim( $c->get_param('category') );
$errors{category} = _("Please choose a category") unless $category;
my $email = $self->trim( $c->get_param('email') );
- $errors{email} = _('Please enter a valid email') unless is_valid_email($email);
+ $errors{email} = _('Please enter a valid email') unless is_valid_email($email) || $email eq 'REFUSED';
$errors{note} = _('Please enter a message') unless $c->get_param('note');
$category = 'Empty property' if $c->cobrand->moniker eq 'emptyhomes';
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 69c94b911..b540a1961 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -219,14 +219,21 @@ sub category_extras_ajax : Path('category_extras') : Args(0) {
return 1;
}
$c->forward('setup_categories_and_bodies');
+ $c->forward('check_for_category');
+ my $category = $c->stash->{category};
my $category_extra = '';
- my $category = $c->get_param('category');
+ my $generate;
if ( $c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1 ) {
$c->stash->{report_meta} = {};
- $c->stash->{report} = { category => $category };
$c->stash->{category_extras} = { $category => $c->stash->{category_extras}->{$category} };
-
+ $generate = 1;
+ }
+ if ($c->stash->{unresponsive}->{$category}) {
+ $generate = 1;
+ }
+ if ($generate) {
+ $c->stash->{report} = { category => $category };
$category_extra = $c->render_fragment( 'report/new/category_extras.html');
}
@@ -604,6 +611,11 @@ sub setup_categories_and_bodies : Private {
my %category_extras = (); # extra fields to fill in for open311
my %non_public_categories =
(); # categories for which the reports are not public
+ $c->stash->{unresponsive} = {};
+
+ if (keys %bodies == 1 && $first_body->send_method && $first_body->send_method eq 'Refused') {
+ $c->stash->{unresponsive}{ALL} = $first_body->id;
+ }
# FIXME - implement in cobrand
if ( $c->cobrand->moniker eq 'emptyhomes' ) {
@@ -641,6 +653,9 @@ sub setup_categories_and_bodies : Private {
$category_extras{ $contact->category } = $metas
if scalar @$metas;
+ $c->stash->{unresponsive}{$contact->category} = $contact->body_id
+ if $contact->email =~ /^REFUSED$/i;
+
$non_public_categories{ $contact->category } = 1 if $contact->non_public;
}
$seen{$contact->category} = 1;
@@ -863,14 +878,19 @@ sub process_report : Private {
return 1;
}
- # construct the bodies string:
- # 'x,x' - x are body IDs that have this category
- # 'x,x|y' - x are body IDs that have this category, y body IDs with *no* contact
- my $body_string = join( ',', map { $_->body_id } @contacts );
- $body_string .=
- '|' . join( ',', map { $_->id } @{ $c->stash->{missing_details_bodies} } )
- if $body_string && @{ $c->stash->{missing_details_bodies} };
- $report->bodies_str($body_string);
+ if ($c->stash->{unresponsive}{$report->category} || $c->stash->{unresponsive}{ALL}) {
+ # Unresponsive, don't try and send a report.
+ $report->bodies_str(-1);
+ } else {
+ # construct the bodies string:
+ # 'x,x' - x are body IDs that have this category
+ # 'x,x|y' - x are body IDs that have this category, y body IDs with *no* contact
+ my $body_string = join( ',', map { $_->body_id } @contacts );
+ $body_string .=
+ '|' . join( ',', map { $_->id } @{ $c->stash->{missing_details_bodies} } )
+ if $body_string && @{ $c->stash->{missing_details_bodies} };
+ $report->bodies_str($body_string);
+ }
my @extra;
# NB: we are only checking extras for the *first* retrieved contact.
diff --git a/perllib/FixMyStreet/App/Controller/Static.pm b/perllib/FixMyStreet/App/Controller/Static.pm
index 8cd82b68e..d91a07fea 100755
--- a/perllib/FixMyStreet/App/Controller/Static.pm
+++ b/perllib/FixMyStreet/App/Controller/Static.pm
@@ -61,6 +61,25 @@ sub council : Global : Args(0) {
my ( $self, $c ) = @_;
}
+sub unresponsive : Global : Args(0) {
+ my ( $self, $c ) = @_;
+ my $body = $c->stash->{body} = $c->model('DB::Body')->find({ id => $c->get_param('body') })
+ or $c->detach( '/page_error_404_not_found' );
+
+ $c->stash->{category} = $c->get_param('category');
+
+ # If the whole body isn't set to refused, we need to check the contacts
+ if (!$body->send_method || $body->send_method ne 'Refused') {
+ my @contacts = $c->model('DB::Contact')->not_deleted->search( { body_id => $body->id } )->all;
+ my $any_unresponsive = 0;
+ foreach my $contact (@contacts) {
+ $any_unresponsive = 1 if $contact->email =~ /^REFUSED$/i;
+ }
+
+ $c->detach( '/page_error_404_not_found' ) unless $any_unresponsive;
+ }
+}
+
__PACKAGE__->meta->make_immutable;
1;
diff --git a/perllib/FixMyStreet/SendReport/Refused.pm b/perllib/FixMyStreet/SendReport/Refused.pm
new file mode 100644
index 000000000..d71fc5c2c
--- /dev/null
+++ b/perllib/FixMyStreet/SendReport/Refused.pm
@@ -0,0 +1,7 @@
+package FixMyStreet::SendReport::Refused;
+
+use Moose;
+
+BEGIN { extends 'FixMyStreet::SendReport::Noop'; }
+
+1;
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 3e1446068..bd0001be8 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -462,7 +462,7 @@ foreach my $test (
};
# check that we got the errors expected
- is_deeply $mech->page_errors, $test->{errors}, "check errors";
+ is_deeply [ sort @{$mech->page_errors} ], [ sort @{$test->{errors}} ], "check errors";
# check that fields have changed as expected
my $new_values = {
@@ -1462,6 +1462,104 @@ subtest "categories from deleted bodies shouldn't be visible for new reports" =>
};
};
+subtest "unresponsive body handling works" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ # Test body-level send method
+ my $old_send = $contact1->body->send_method;
+ $contact1->body->update( { send_method => 'Refused' } );
+ $mech->get_ok('/report/new/ajax?latitude=55.9&longitude=-3.2'); # Edinburgh
+ my $body_id = $contact1->body->id;
+ ok $mech->content_like( qr{Edinburgh.*accept reports.*/unresponsive\?body=$body_id} );
+
+ my $test_email = 'test-2@example.com';
+ my $user = $mech->log_in_ok($test_email);
+ $mech->get_ok('/around');
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" );
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ title => "Test Report at café",
+ detail => 'Test report details.',
+ photo => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ phone => '07903 123 456',
+ category => 'Trees',
+ }
+ },
+ "submit good details"
+ );
+
+ my $report = $user->problems->first;
+ ok $report, "Found the report";
+ is $report->bodies_str, undef, "Report not going anywhere";
+
+ $user->problems->delete;
+ $contact1->body->update( { send_method => $old_send } );
+
+ # And test per-category refusing
+ my $old_email = $contact3->email;
+ $contact3->update( { email => 'REFUSED' } );
+ $mech->get_ok('/report/new/category_extras?category=Trees&latitude=51.89&longitude=-2.09');
+ ok $mech->content_like( qr/Cheltenham.*Trees.*unresponsive.*category=Trees/ );
+
+ $mech->get_ok('/around');
+ $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR', } }, "submit location" );
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ title => "Test Report at café",
+ detail => 'Test report details.',
+ photo => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ phone => '07903 123 456',
+ category => 'Trees',
+ }
+ },
+ "submit good details"
+ );
+
+ $report = $user->problems->first;
+ ok $report, "Found the report";
+ is $report->bodies_str, undef, "Report not going anywhere";
+
+ $contact3->update( { email => $old_email } );
+ $mech->delete_user($user);
+ };
+};
+
+subtest "unresponsive body page works" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ my $old_send = $contact1->body->send_method;
+ my $body_id = $contact1->body->id;
+ my $url = "/unresponsive?body=$body_id";
+ is $mech->get($url)->code, 404, "page not found";
+ $contact1->body->update( { send_method => 'Refused' } );
+ $mech->get_ok($url);
+ $mech->content_contains('Edinburgh');
+ $contact1->body->update( { send_method => $old_send } );
+
+ my $old_email = $contact3->email;
+ $body_id = $contact3->body->id;
+ $url = "/unresponsive?body=$body_id;category=Trees";
+ is $mech->get($url)->code, 404, "page not found";
+ $contact3->update( { email => 'REFUSED' } );
+ $mech->get_ok($url);
+ $mech->content_contains('Cheltenham');
+ $mech->content_contains('Trees');
+ $contact3->update( { email => $old_email } );
+ };
+};
+
subtest "extra google analytics code displayed on logged in problem creation" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t
index 53b84b92d..d3ca93f0e 100644
--- a/t/app/controller/report_new_open311.t
+++ b/t/app/controller/report_new_open311.t
@@ -60,9 +60,9 @@ foreach my $test (
type => 'old',
},
errors => [
+ 'This information is required',
'Please enter a subject',
'Please enter some details',
- 'This information is required',
'Please enter your email',
'Please enter your name',
],
diff --git a/templates/web/base/report/new/category.html b/templates/web/base/report/new/category.html
index ee47adc9e..f640c548c 100644
--- a/templates/web/base/report/new/category.html
+++ b/templates/web/base/report/new/category.html
@@ -9,7 +9,7 @@
[%- ELSE %]
[%- loc('Category') %]
[%- END -%]</label>
- <select name='category' id='form_category'[% ' onchange="form_category_onchange()"' IF category_extras.size %]>
+ <select name='category' id='form_category'>
[% FOREACH cat_op IN category_options %]
[% cat_op_lc = cat_op | lower %]
<option value='[% cat_op | html %]'[% ' selected' IF report.category == cat_op || category == cat_op_lc || (category_options.size == 2 AND loop.last) -%]
diff --git a/templates/web/base/report/new/category_extras.html b/templates/web/base/report/new/category_extras.html
index 41984dd9a..c0f6a7bae 100644
--- a/templates/web/base/report/new/category_extras.html
+++ b/templates/web/base/report/new/category_extras.html
@@ -1,6 +1,11 @@
<div id="category_meta">
+ [%- category = report.category -%]
+
+ [%- IF unresponsive.$category %]
+ [% INCLUDE "report/new/unresponsive_body.html" body_id = unresponsive.$category %]
+ [%- END %]
+
[%- IF report_meta %]
- [%- category = report.category %]
<h4>Additional Information</h4>
[%- FOR meta IN category_extras.$category %]
[%- meta_name = meta.code -%]
diff --git a/templates/web/base/report/new/category_wrapper.html b/templates/web/base/report/new/category_wrapper.html
new file mode 100644
index 000000000..f6bb618f0
--- /dev/null
+++ b/templates/web/base/report/new/category_wrapper.html
@@ -0,0 +1,17 @@
+[% IF js %]
+ <div id="form_category_row">
+ <label for="form_category">[% loc('Category') %]</label>
+ <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
+ </div>
+[% ELSE %]
+ [% IF category_options.size %]
+ [% IF field_errors.category %]
+ <p class='form-error'>[% field_errors.category %]</p>
+ [% END %]
+ [% PROCESS "report/new/category.html" %]
+ [% END %]
+[% END %]
+
+[%- IF category_extras %]
+ [% PROCESS "report/new/category_extras.html" %]
+[%- END %]
diff --git a/templates/web/base/report/new/councils_text.html b/templates/web/base/report/new/councils_text.html
index f526beb28..65e41f0d1 100644
--- a/templates/web/base/report/new/councils_text.html
+++ b/templates/web/base/report/new/councils_text.html
@@ -1,5 +1,7 @@
[% FILTER collapse %]
-[% IF bodies_to_list.size == 0 %]
+[% IF unresponsive.ALL %]
+ [% PROCESS 'report/new/unresponsive_body.html' body_id = unresponsive.ALL %]
+[% ELSIF bodies_to_list.size == 0 %]
[% PROCESS 'report/new/councils_text_none.html' %]
[% ELSIF bodies_to_list.size == bodies.size %]
[% PROCESS 'report/new/councils_text_all.html' %]
diff --git a/templates/web/base/report/new/fill_in_details_form.html b/templates/web/base/report/new/fill_in_details_form.html
index cee0244c7..d1431ffd3 100644
--- a/templates/web/base/report/new/fill_in_details_form.html
+++ b/templates/web/base/report/new/fill_in_details_form.html
@@ -63,26 +63,7 @@
<textarea name="detail" id="form_detail" rows="7" cols="26" required>[% report.detail | html %]</textarea>
</div>
-[% IF js %]
- <div class="form-field" id="form_category_row">
- <label for="form_category">[% loc('Category:') %]</label>
- <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
- </div>
-[% ELSE %]
- [% IF category_options.size %]
- [% IF field_errors.category %]
- <div class='form-error'>[% field_errors.category %]</div>
- [% END %]
-
- <div class="form-field">
- [% PROCESS "report/new/category.html" %]
- </div>
- [% END %]
-[% END %]
-
-[%- IF category_extras %]
-[% PROCESS "report/new/category_extras.html" %]
-[%- END %]
+[% PROCESS "report/new/category_wrapper.html" %]
[% IF c.cobrand.allow_photo_upload %]
[% IF field_errors.photo %]
diff --git a/templates/web/bromley/report/new/fill_in_details_form.html b/templates/web/bromley/report/new/fill_in_details_form.html
index e5c920eae..6bf077322 100644
--- a/templates/web/bromley/report/new/fill_in_details_form.html
+++ b/templates/web/bromley/report/new/fill_in_details_form.html
@@ -60,24 +60,7 @@
[% END %]
<textarea rows="7" cols="26" name="detail" id="form_detail" placeholder="[% loc('Please describe the exact location of the report. Example: “2 dumped mattresses outside Number 19 Stockwell Close”') %]" required>[% report.detail | html %]</textarea>
- [% IF js %]
- <div id="form_category_row">
- <label for="form_category">[% loc('Category') %]</label>
- <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
- </div>
- [% ELSE %]
- [% IF category_options.size %]
- [% IF field_errors.category %]
- <p class='form-error'>[% field_errors.category %]</p>
- [% END %]
-
- [% PROCESS "report/new/category.html" %]
- [% END %]
- [% END %]
-
- [%- IF category_extras %]
- [% PROCESS "report/new/category_extras.html" %]
- [%- END %]
+ [% PROCESS "report/new/category_wrapper.html" %]
[% IF c.cobrand.allow_photo_upload %]
[% IF field_errors.photo %]
diff --git a/templates/web/eastsussex/report/new/category.html b/templates/web/eastsussex/report/new/category.html
index 1759f450f..e4a7ed456 100644
--- a/templates/web/eastsussex/report/new/category.html
+++ b/templates/web/eastsussex/report/new/category.html
@@ -6,7 +6,7 @@
<label for='form_category' id="form_category_label">
Type
</label>
- <select name='category' id='form_category'[% ' onchange="form_category_onchange()"' IF category_extras.size %]>
+ <select name='category' id='form_category'>
[% FOREACH cat_op IN category_options %]
[% cat_op_lc = cat_op | lower %]
[% IF loop.first; cat_op = '-- Pick a type --'; END %]
diff --git a/templates/web/emptyhomes/report/new/fill_in_details_form.html b/templates/web/emptyhomes/report/new/fill_in_details_form.html
index e6ddd56a0..20b0b6842 100644
--- a/templates/web/emptyhomes/report/new/fill_in_details_form.html
+++ b/templates/web/emptyhomes/report/new/fill_in_details_form.html
@@ -45,22 +45,7 @@
<p>[% loc('Please do not give address or personal information in this section.') %]</p>
-[% IF js %]
- <div class="form-field" id="form_category_row">
- <label for="form_category">[% loc('Category:') %]</label>
- <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
- </div>
-[% ELSE %]
- [% IF category_options.size %]
- [% IF field_errors.category %]
- <div class='form-error'>[% field_errors.category %]</div>
- [% END %]
-
- <div class="form-field">
- [% PROCESS "report/new/category.html" %]
- </div>
- [% END %]
-[% END %]
+[% PROCESS "report/new/category_wrapper.html" %]
[% IF field_errors.title %]
<div class='form-error'>[% field_errors.title %]</div>
diff --git a/templates/web/fixmystreet.com/report/new/category_at_top.html b/templates/web/fixmystreet.com/report/new/category_at_top.html
new file mode 100644
index 000000000..f131f37a1
--- /dev/null
+++ b/templates/web/fixmystreet.com/report/new/category_at_top.html
@@ -0,0 +1 @@
+[% PROCESS "report/new/category_wrapper.html" %]
diff --git a/templates/web/fixmystreet.com/report/new/unresponsive_body.html b/templates/web/fixmystreet.com/report/new/unresponsive_body.html
new file mode 100644
index 000000000..a1b41aaf5
--- /dev/null
+++ b/templates/web/fixmystreet.com/report/new/unresponsive_body.html
@@ -0,0 +1,12 @@
+<div class="unresponsive-council-warning">
+ <h1>Important message</h1>
+ <p>
+ <span class="unresponsive-council">[% bodies.$body_id.name %]</span> doesn’t accept
+ [% IF category %]
+ <span class="refused-category">[% category | html %]</span>
+ [% END %]
+ reports.
+ </p>
+ <p>We can make your report public, but we can’t send it to the council.</p>
+ <a href="/unresponsive?body=[% body_id %][% IF category %];category=[% category | uri %][% END %]">What can I do instead?</a>
+</div>
diff --git a/templates/web/fixmystreet.com/static/unresponsive.html b/templates/web/fixmystreet.com/static/unresponsive.html
new file mode 100644
index 000000000..3f09533bf
--- /dev/null
+++ b/templates/web/fixmystreet.com/static/unresponsive.html
@@ -0,0 +1,38 @@
+[% INCLUDE header.html
+ title = 'Unresponsive councils: What you can do', bodyclass = 'unresponsive-council fullwidthpage'
+%]
+
+<div class="unresponsive-council__header">
+ <h1>Bad news :(</h1>
+ <p><strong class="unresponsive-council-name">[% body.name %]</strong> no
+ longer accepts [% IF category %][% category | html %][% END %]
+ reports from FixMyStreet.</p>
+</div>
+
+<div class="unresponsive-council__body">
+ <p><strong class="unresponsive-council-name">[% body.name %]</strong> is one
+ of only <strong>2%</strong> of councils that don’t accept reports from
+ FixMyStreet. We’re sad about it too, but here’s some things you can do now:</p>
+
+ [% IF NOT body.external_url %]
+ <a href="[% body.external_url %]" class="unresponsive-council-cta unresponsive-council-cta--primary">
+ <strong>Report your issue directly</strong> to <span class="unresponsive-council-name">[% body.name %]</span> on their website
+ </a>
+ [% ELSE %]
+ <a href="https://www.google.co.uk/search?q=report+[% body.name | uri %]" class="unresponsive-council-cta unresponsive-council-cta--primary">
+ Find the website of <span class="unresponsive-council-name">[% body.name %]</span> and <strong>report your issue directly</strong>
+ </a>
+ [% END %]
+
+ <h2>If you’d prefer to use FixMyStreet next time:</h2>
+
+ <a href="https://www.writetothem.com/" class="unresponsive-council-cta">
+ <strong>Write to your MP or local councillors</strong> to let them know this isn’t okay
+ </a>
+
+ <a href="https://twitter.com/intent/tweet?via=fixmystreet" class="unresponsive-council-cta">
+ <strong>Tweet</strong> to let <span class="unresponsive-council-name">[% body.name %]</span></strong> know you’d rather use FixMyStreet
+ </a>
+</div>
+
+[% INCLUDE footer.html %]
diff --git a/templates/web/fixmystreet/report/new/fill_in_details_form.html b/templates/web/fixmystreet/report/new/fill_in_details_form.html
index 75e11c74f..82b1097b7 100644
--- a/templates/web/fixmystreet/report/new/fill_in_details_form.html
+++ b/templates/web/fixmystreet/report/new/fill_in_details_form.html
@@ -34,6 +34,14 @@
<p class='form-error'>[% field_errors.bodies %]</p>
[% END %]
+ [% TRY %]
+ [%# Useful for amending form contents based on category selection %]
+ [% PROCESS 'report/new/category_at_top.html' %]
+ [% need_to_show_category_selector = 0 %]
+ [% CATCH file %]
+ [% need_to_show_category_selector = 1 %]
+ [% END %]
+
<label for="form_title">[% loc('One-line summary') %] [% INCLUDE 'report/public_label.html' %]</label>
[% IF field_errors.title %]
<p class='form-error'>[% field_errors.title %]</p>
@@ -48,24 +56,10 @@
[% TRY %][% PROCESS 'report/new/inline-tips.html' %][% CATCH file %][% END %]
- [% IF js %]
- <div id="form_category_row">
- <label for="form_category">[% loc('Category') %]</label>
- <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
- </div>
- [% ELSE %]
- [% IF category_options.size %]
- [% IF field_errors.category %]
- <p class='form-error'>[% field_errors.category %]</p>
- [% END %]
- [% PROCESS "report/new/category.html" %]
- [% END %]
+ [% IF need_to_show_category_selector %]
+ [% PROCESS "report/new/category_wrapper.html" %]
[% END %]
- [%- IF category_extras %]
- [% PROCESS "report/new/category_extras.html" %]
- [%- END %]
-
[% TRY %][% PROCESS 'report/new/after_category.html' %][% CATCH file %][% END %]
[% IF c.cobrand.allow_photo_upload %]
diff --git a/templates/web/seesomething/report/new/category.html b/templates/web/seesomething/report/new/category.html
index 8c837a047..691c38497 100644
--- a/templates/web/seesomething/report/new/category.html
+++ b/templates/web/seesomething/report/new/category.html
@@ -4,7 +4,7 @@
category = category | lower;
END; %]
<label for='form_category' class="select">[% loc('Category') %]</label>
- <select name='category' data-theme="c" id='form_category'[% ' onchange="form_category_onchange()"' IF category_extras.size %]>
+ <select name='category' data-theme="c" id='form_category'>
[% FOREACH cat_op IN category_options %]
[% cat_op_lc = cat_op | lower %]
<option value='[% cat_op | html %]'[% ' selected' IF report.category == cat_op || category == cat_op_lc %]>[% cat_op | html %]</option>
diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html
index 67471867a..28d9ebe68 100644
--- a/templates/web/zurich/report/new/fill_in_details_form.html
+++ b/templates/web/zurich/report/new/fill_in_details_form.html
@@ -45,24 +45,7 @@
[% END %]
<textarea rows="7" cols="26" name="detail" id="form_detail" placeholder="[% loc('Please fill in details of the problem.') %]" required>[% report.detail | html %]</textarea>
- [% IF js %]
- <div id="form_category_row">
- <label for="form_category">[% loc('Category') %]</label>
- <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
- </div>
- [% ELSE %]
- [% IF category_options.size %]
- [% IF field_errors.category %]
- <p class='form-error'>[% field_errors.category %]</p>
- [% END %]
-
- [% PROCESS "report/new/category.html" %]
- [% END %]
- [% END %]
-
- [%- IF category_extras %]
- [% PROCESS "report/new/category_extras.html" %]
- [%- END %]
+ [% PROCESS "report/new/category_wrapper.html" %]
[% IF c.cobrand.allow_photo_upload %]
<label for="form_photo">[% loc('Photo') %]</label>
diff --git a/web/cobrands/fixmystreet/base.scss b/web/cobrands/fixmystreet/base.scss
index 3baac2eb0..6e6cbd7b9 100644
--- a/web/cobrands/fixmystreet/base.scss
+++ b/web/cobrands/fixmystreet/base.scss
@@ -123,3 +123,79 @@
margin: 0.5em 0 1em 0;
}
}
+
+.unresponsive-council-warning {
+ margin: 1em -1em;
+ padding: 2em 2em;
+ background-color: mix(#fff, $primary, 70%);
+
+ h1 {
+ font-size: 1.4em;
+ }
+
+ p {
+ margin-bottom: 0.5em;
+ }
+
+ a {
+ display: inline-block;
+ margin-top: 0.5em;
+ padding: 0.5em 1em;
+ background-color: #000;
+ color: #fff;
+ border-radius: 0.3em;
+
+ &:hover,
+ &:focus {
+ text-decoration: none;
+ background-color: mix(#000, $primary, 70%);
+ }
+ }
+}
+
+.unresponsive-council__header {
+ padding-bottom: 1em;
+ border-bottom: 1px solid #ccc;
+ margin-bottom: 1em;
+
+ p {
+ font-size: 1.2em;
+ margin-bottom: 0;
+ }
+}
+
+.unresponsive-council-cta {
+ display: block;
+ padding: 1em;
+ margin: 1em 0;
+ background-color: #555;
+ border-radius: 0.2em;
+ color: #fff;
+
+ &:visited {
+ color: #fff;
+ }
+
+ &:hover,
+ &:focus {
+ text-decoration: none;
+ background-color: #777;
+ color: #fff;
+ }
+}
+
+.unresponsive-council-cta--primary {
+ background-color: $primary;
+ color: #000;
+
+ &:visited {
+ color: #000;
+ }
+
+ &:hover,
+ &:focus {
+ background-color: mix(#fff, $primary, 30%);
+ color: #000;
+ }
+}
+
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 31925e977..f5e6a8926 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -42,7 +42,7 @@ function tabs(elem, indirect) {
//toggle class on nav
$('.tab-nav .active').removeClass('active');
elem.addClass('active');
-
+
//hide / show the right tab
$('.tab.open').hide().removeClass('open');
$(target).show().addClass('open');
@@ -134,8 +134,8 @@ $(function(){
last_type = type;
}).resize();
- /*
- * Report a problem page
+ /*
+ * Report a problem page
*/
//desktop
if ($('#report-a-problem-sidebar').is(':visible')) {
@@ -178,10 +178,10 @@ $(function(){
//make initial tab active
$('.tab-nav a').first().addClass('active');
$('.tab').first().addClass('open');
-
+
//hide other tabs
$('.tab').not('.open').hide();
-
+
//set up click event
$(".tab-nav").on('click', 'a', function(e){
e.preventDefault();
@@ -306,7 +306,7 @@ $.fn.drawer = function(id, ajax) {
$('.spinner').remove();
});
}
-
+
// Tall drawer - put after .content for scrolling to work okay.
// position over the top of the main .content in precisely the right location
d.insertAfter($content).addClass('content').css({
@@ -486,4 +486,3 @@ $(window).load(function(){
}, 0);
});
*/
-
diff --git a/web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow.png b/web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow.png
new file mode 100644
index 000000000..664721830
--- /dev/null
+++ b/web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow.png
Binary files differ
diff --git a/web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow@2.png b/web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow@2.png
new file mode 100644
index 000000000..181d8402b
--- /dev/null
+++ b/web/cobrands/fixmystreet/images/unresponsive-council-cta-arrow@2.png
Binary files differ
diff --git a/web/cobrands/fixmystreet/layout.scss b/web/cobrands/fixmystreet/layout.scss
index 009ab5bcb..1d56e675c 100644
--- a/web/cobrands/fixmystreet/layout.scss
+++ b/web/cobrands/fixmystreet/layout.scss
@@ -301,3 +301,54 @@ body.alertindex {
}
}
}
+
+body.unresponsive-council {
+ .container .content {
+ padding: 0;
+ margin-bottom: 4em;
+ }
+
+ h1, h2 {
+ font-family: inherit;
+ font-weight: bold;
+ }
+}
+
+.unresponsive-council__header,
+.unresponsive-council__body {
+ padding: 1.5em;
+ font-size: 1.3em;
+}
+
+.unresponsive-council__header {
+ background-color: $primary;
+
+ border-bottom: none;
+ margin-bottom: 0;
+
+ h1 {
+ font-size: 2.5em;
+ line-height: 1em;
+ margin-bottom: 0.2em;
+ }
+}
+
+.unresponsive-council__body {
+ p {
+ max-width: 26em;
+ }
+}
+
+.unresponsive-council-cta {
+ margin: 1.5em 0;
+ max-width: 20em;
+ padding-right: 6em;
+ background-image: url(images/unresponsive-council-cta-arrow.png);
+ background-position: right center;
+ background-repeat: no-repeat;
+
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
+ background-image: url(images/unresponsive-council-cta-arrow@2.png);
+ background-size: 60px;
+ }
+} \ No newline at end of file
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index a9ffe7295..98e032598 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -163,15 +163,18 @@ select {
width: 100%;
}
-// links
-a,
-a:visited {
- text-decoration:none;
- color:#0BA7D1;
+a {
+ text-decoration: none;
+ color: #0BA7D1;
+
+ &:visited {
+ color: #0BA7D1;
+ }
+
&:hover,
&:active {
- text-decoration:underline;
- color:#0D7CCE;
+ text-decoration: underline;
+ color: #0D7CCE;
}
}
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index a0ab4f34c..7b7bee7e8 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -9,8 +9,8 @@ function fixmystreet_update_pin(lonlat) {
document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x;
$.getJSON('/report/new/ajax', {
- latitude: $('#fixmystreet\\.latitude').val(),
- longitude: $('#fixmystreet\\.longitude').val()
+ latitude: $('#fixmystreet\\.latitude').val(),
+ longitude: $('#fixmystreet\\.longitude').val()
}, function(data) {
if (data.error) {
if (!$('#side-form-error').length) {
@@ -29,6 +29,7 @@ function fixmystreet_update_pin(lonlat) {
if ( lb.length === 0 ) { lb = $('#form_name').prev(); }
lb.before(data.extra_name_info);
}
+
// If the category filter appears on the map and the user has selected
// something from it, then pre-fill the category field in the report,
// if it's a value already present in the drop-down.
@@ -36,6 +37,11 @@ function fixmystreet_update_pin(lonlat) {
if (category !== undefined && $("#form_category option[value="+category+"]").length) {
$("#form_category").val(category);
}
+
+ var category_select = $("select#form_category");
+ if (category_select.val() != '-- Pick a category --') {
+ category_select.change();
+ }
});
if (!$('#side-form-error').is(':visible')) {