aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md10
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm16
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm19
-rw-r--r--perllib/FixMyStreet/App/Controller/JSON.pm22
-rw-r--r--perllib/FixMyStreet/Cobrand/BathNES.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm27
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm16
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm5
-rw-r--r--perllib/FixMyStreet/DateRange.pm72
-rw-r--r--t/app/controller/report_new.t4
-rw-r--r--t/app/controller/report_new_text.t2
-rw-r--r--t/app/controller/report_updates.t6
-rw-r--r--t/cobrand/bromley.t2
-rw-r--r--templates/web/base/admin/users/form.html4
-rw-r--r--templates/web/base/maps/pin.html2
-rw-r--r--templates/web/base/questionnaire/creator_fixed.html14
-rw-r--r--templates/web/base/report/_item.html2
-rw-r--r--templates/web/base/report/_item_expandable.html4
-rw-r--r--templates/web/base/report/_show_name_label.html1
-rw-r--r--templates/web/base/tokens/confirm_problem.html4
-rw-r--r--templates/web/base/user/_anonymity.html4
-rw-r--r--templates/web/bathnes/report/_show_name_label.html1
-rw-r--r--templates/web/zurich/tokens/confirm_problem.html2
-rw-r--r--web/cobrands/bathnes/js.js38
-rw-r--r--web/cobrands/fixmystreet-uk-councils/roadworks.js52
-rw-r--r--web/cobrands/lincolnshire/roadworks.js28
-rw-r--r--web/cobrands/sass/_base.scss2
-rw-r--r--web/cobrands/zurich/base.scss15
29 files changed, 211 insertions, 167 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index abe507e60..9b67c782f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
while reporting, to discourage duplicate reports. #2386
- Front end improvements:
- Track map state in URL to make sharing links easier. #2242
+ - Default to unchecked for show name checkbox. #347
- Admin improvements:
- Include moderation history in report updates. #2379
- Allow moderation to potentially change state. #2381
@@ -23,9 +24,18 @@
- Fix issue with Open311 codes starting with ‘_’. #2391
- Add parameter to URL when “Show older” clicked. #2397
- Don't ask for email on alert signup if logged in. #2402
+ - Filter out hidden reports from top 5 list. #1957
+ - Add space below "map page" contents on narrow screens.
+ - Use relative report links where possible. #1995
+ - Improve inline checkbox spacing. #2411
- Development improvements:
- Make front page cache time configurable.
- Better working of /fakemapit/ under https.
+ - Backwards incompatible changes:
+ - If you wish the default for the showname checkbox to be checked,
+ add `sub default_show_name { 1 }` to your cobrand file.
+ - The admin body and user sections have been refactored – if you have
+ custom templates/code, you may need to update links to those.
* v2.5 (21st December 2018)
- Front end improvements:
diff --git a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm
index d965dd8f2..0026acb9c 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm
@@ -5,6 +5,7 @@ use namespace::autoclean;
use DateTime;
use Try::Tiny;
use FixMyStreet::Integrations::ExorRDI;
+use FixMyStreet::DateRange;
BEGIN { extends 'Catalyst::Controller'; }
@@ -43,15 +44,16 @@ sub download : Path('download') : Args(0) {
$c->detach( '/page_error_404_not_found', [] );
}
- my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d' );
- my $start_date = $parser-> parse_datetime ( $c->get_param('start_date') );
- my $end_date = $parser-> parse_datetime ( $c->get_param('end_date') ) ;
- my $one_day = DateTime::Duration->new( days => 1 );
+ my $range = FixMyStreet::DateRange->new(
+ start_date => $c->get_param('start_date'),
+ end_date => $c->get_param('end_date'),
+ parser => DateTime::Format::Strptime->new( pattern => '%Y-%m-%d' ),
+ );
my $params = {
- start_date => $start_date,
- inspection_date => $start_date,
- end_date => $end_date + $one_day,
+ start_date => $range->start,
+ inspection_date => $range->start,
+ end_date => $range->end,
user => $c->get_param('user_id'),
mark_as_processed => 0,
};
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index fcd5bb748..bd60f8570 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -8,6 +8,7 @@ use JSON::MaybeXS;
use Path::Tiny;
use Text::CSV;
use Time::Piece;
+use FixMyStreet::DateRange;
BEGIN { extends 'Catalyst::Controller'; }
@@ -162,16 +163,16 @@ sub construct_rs_filter : Private {
$where{"$table_name.state"} = [ FixMyStreet::DB::Result::Problem->visible_states() ];
}
- my $dtf = $c->model('DB')->storage->datetime_parser;
-
- my $start_date = $dtf->parse_datetime($c->stash->{start_date});
- $where{"$table_name.confirmed"} = { '>=', $dtf->format_datetime($start_date) };
+ my $days30 = DateTime->now(time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone)->subtract(days => 30);
+ $days30->truncate( to => 'day' );
- if (my $end_date = $c->stash->{end_date}) {
- my $one_day = DateTime::Duration->new( days => 1 );
- $end_date = $dtf->parse_datetime($end_date) + $one_day;
- $where{"$table_name.confirmed"} = [ -and => $where{"$table_name.confirmed"}, { '<', $dtf->format_datetime($end_date) } ];
- }
+ my $range = FixMyStreet::DateRange->new(
+ start_date => $c->stash->{start_date},
+ start_default => $days30,
+ end_date => $c->stash->{end_date},
+ formatter => $c->model('DB')->storage->datetime_parser,
+ );
+ $where{"$table_name.confirmed"} = $range->sql;
$c->stash->{params} = \%where;
my $rs = $updates ? $c->cobrand->updates : $c->cobrand->problems;
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm
index 762e3c115..e1e135054 100644
--- a/perllib/FixMyStreet/App/Controller/JSON.pm
+++ b/perllib/FixMyStreet/App/Controller/JSON.pm
@@ -8,6 +8,7 @@ use JSON::MaybeXS;
use DateTime;
use DateTime::Format::ISO8601;
use List::MoreUtils 'uniq';
+use FixMyStreet::DateRange;
=head1 NAME
@@ -50,16 +51,19 @@ sub problems : Local {
}
# convert the dates to datetimes and trap errors
- my $iso8601 = DateTime::Format::ISO8601->new;
- my $start_dt = eval { $iso8601->parse_datetime($start_date); };
- my $end_dt = eval { $iso8601->parse_datetime($end_date); };
- unless ( $start_dt && $end_dt ) {
+ my $range = FixMyStreet::DateRange->new(
+ start_date => $start_date,
+ end_date => $end_date,
+ parser => DateTime::Format::ISO8601->new,
+ formatter => $c->model('DB')->schema->storage->datetime_parser,
+ );
+ unless ($range->start && $range->end) {
$c->stash->{error} = 'Invalid dates supplied';
return;
}
# check that the dates are sane
- if ( $start_dt > $end_dt ) {
+ if ($range->start >= $range->end) {
$c->stash->{error} = 'Start date after end date';
return;
}
@@ -80,14 +84,8 @@ sub problems : Local {
$date_col = 'lastupdate';
}
- my $dt_parser = $c->model('DB')->schema->storage->datetime_parser;
-
- my $one_day = DateTime::Duration->new( days => 1 );
my $query = {
- $date_col => {
- '>=' => $dt_parser->format_datetime($start_dt),
- '<=' => $dt_parser->format_datetime($end_dt + $one_day),
- },
+ $date_col => $range->sql,
state => [ @state ],
};
$query->{category} = $category if $category;
diff --git a/perllib/FixMyStreet/Cobrand/BathNES.pm b/perllib/FixMyStreet/Cobrand/BathNES.pm
index 800ca88fa..e3ae6763f 100644
--- a/perllib/FixMyStreet/Cobrand/BathNES.pm
+++ b/perllib/FixMyStreet/Cobrand/BathNES.pm
@@ -91,8 +91,6 @@ sub send_questionnaires { 0 }
sub enable_category_groups { 1 }
-sub default_show_name { 0 }
-
sub default_map_zoom { 3 }
sub map_js_extra {
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 6def2b2b1..950431e85 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -7,6 +7,7 @@ use utf8;
use DateTime::Format::W3CDTF;
use DateTime::Format::Flexible;
use Try::Tiny;
+use FixMyStreet::DateRange;
sub council_area_id { return 2482; }
sub council_area { return 'Bromley'; }
@@ -45,8 +46,6 @@ sub problems_on_map_restriction {
return $rs->to_body($tfl ? [ $self->body->id, $tfl->id ] : $self->body);
}
-sub default_show_name { 0 }
-
sub disambiguate_location {
my $self = shift;
my $string = shift;
@@ -387,27 +386,17 @@ sub munge_load_and_group_problems {
}
# Date range
- my $dtf = $c->model('DB')->storage->datetime_parser;
- my $dtp = DateTime::Format::Flexible->new;
my $start_default = DateTime->today(time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone)->subtract(months => 3);
$c->stash->{start_date} = $c->get_param('start_date') || $start_default->strftime('%Y-%m-%d');
$c->stash->{end_date} = $c->get_param('end_date');
- my $start_date = try {
- $dtp->parse_datetime($c->stash->{start_date}, european => 1);
- } catch {
- $start_default;
- };
- $where->{'me.confirmed'} = { '>=', $dtf->format_datetime($start_date) };
-
- my $end_date = try {
- $dtp->parse_datetime($c->stash->{end_date}, european => 1);
- };
- if ($end_date) {
- my $one_day = DateTime::Duration->new( days => 1 );
- $end_date += $one_day;
- $where->{'me.confirmed'} = [ -and => $where->{'me.confirmed'}, { '<', $dtf->format_datetime($end_date) } ];
- }
+ my $range = FixMyStreet::DateRange->new(
+ start_date => $c->stash->{start_date},
+ start_default => $start_default,
+ end_date => $c->stash->{end_date},
+ formatter => $c->model('DB')->storage->datetime_parser,
+ );
+ $where->{'me.confirmed'} = $range->sql;
delete $filter->{rows};
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 4c5d29ee5..53d25cec2 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -237,6 +237,18 @@ sub base_url_for_report {
return $self->base_url_with_lang;
}
+=item relative_url_for_report
+
+Returns the relative base url for a report (might be different in a two-tier
+county, but normally blank). Report may be an object, or a hashref.
+
+=cut
+
+sub relative_url_for_report {
+ my ( $self, $report ) = @_;
+ return "";
+}
+
=item base_host
Return the base host for the cobranded version of the site
@@ -1000,9 +1012,7 @@ Returns true if the show name checkbox should be ticked by default.
=cut
-sub default_show_name {
- 1;
-}
+sub default_show_name { 0 }
=item report_check_for_errors
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
index b8dc49f72..5def2bb61 100644
--- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
@@ -73,8 +73,6 @@ sub default_map_zoom { return 3; }
# let staff hide OCC reports
sub users_can_hide { return 1; }
-sub default_show_name { 0 }
-
sub lookup_by_ref_regex {
return qr/^\s*((?:ENQ)?\d+)\s*$/;
}
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index ab3d8f91b..1beafef73 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -204,6 +204,11 @@ sub base_url_for_report {
}
}
+sub relative_url_for_report {
+ my ( $self, $report ) = @_;
+ return $self->owns_problem($report) ? "" : FixMyStreet->config('BASE_URL');
+}
+
sub admin_allow_user {
my ( $self, $user ) = @_;
return 1 if $user->is_superuser;
diff --git a/perllib/FixMyStreet/DateRange.pm b/perllib/FixMyStreet/DateRange.pm
new file mode 100644
index 000000000..bc4f4e1af
--- /dev/null
+++ b/perllib/FixMyStreet/DateRange.pm
@@ -0,0 +1,72 @@
+package FixMyStreet::DateRange;
+
+use DateTime;
+use DateTime::Format::Flexible;
+use Moo;
+use Try::Tiny;
+
+my $one_day = DateTime::Duration->new( days => 1 );
+
+has start_date => ( is => 'ro' );
+
+has start_default => ( is => 'ro' );
+
+has end_date => ( is => 'ro' );
+
+has parser => (
+ is => 'ro',
+ default => sub { DateTime::Format::Flexible->new }
+);
+
+has formatter => (
+ is => 'lazy',
+ default => sub {
+ my $self = shift;
+ return $self->parser;
+ }
+);
+
+sub _dt {
+ my ($self, $date) = @_;
+ my %params;
+ $params{european} = 1 if $self->parser->isa('DateTime::Format::Flexible');
+ my $d = try {
+ $self->parser->parse_datetime($date, %params)
+ };
+ return $d;
+}
+
+sub start {
+ my $self = shift;
+ $self->_dt($self->start_date) || $self->start_default
+}
+
+sub end {
+ my $self = shift;
+ my $d = $self->_dt($self->end_date);
+ $d += $one_day if $d;
+ return $d;
+}
+
+sub _formatted {
+ my ($self, $dt) = @_;
+ return unless $dt;
+ $self->formatter->format_datetime($dt);
+}
+
+sub start_formatted { $_[0]->_formatted($_[0]->start) }
+sub end_formatted { $_[0]->_formatted($_[0]->end) }
+
+sub sql {
+ my ($self, $default) = @_;
+ my $sql = {};
+ if (my $start = $self->start_formatted) {
+ $sql->{'>='} = $start;
+ }
+ if (my $end = $self->end_formatted) {
+ $sql->{'<'} = $end;
+ }
+ return $sql;
+}
+
+1;
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index d50a682cf..d9fae5fbc 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1719,7 +1719,7 @@ subtest "test Hart" => sub {
if ( $test->{confirm} ) {
is $mech->uri->path, "/report/new";
my $base = 'www.fixmystreet.com';
- $base = "hart.fixmystreet.com" unless $test->{national};
+ $base = '"' unless $test->{national};
$mech->content_contains("$base/report/" . $report->id, "links to correct site");
} else {
# receive token
@@ -1746,7 +1746,7 @@ subtest "test Hart" => sub {
};
my $base = 'www.fixmystreet.com';
- $base = 'hart.fixmystreet.com' unless $test->{national};
+ $base = '"' unless $test->{national};
$mech->content_contains( $base . '/report/' .
$report->id, 'confirm page links to correct site' );
diff --git a/t/app/controller/report_new_text.t b/t/app/controller/report_new_text.t
index e6f0a9017..fad7fb6ab 100644
--- a/t/app/controller/report_new_text.t
+++ b/t/app/controller/report_new_text.t
@@ -324,7 +324,7 @@ subtest "test report creation for a user who is logged in" => sub {
{
title => '',
detail => '',
- may_show_name => '1',
+ may_show_name => undef,
name => 'Joe Bloggs',
email => 'joe@example.net',
photo1 => '',
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 76594a74a..8ff5b4d24 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -368,7 +368,7 @@ for my $test (
initial_values => {
name => '',
username => '',
- may_show_name => 1,
+ may_show_name => undef,
add_alert => 1,
photo1 => '',
photo2 => '',
@@ -393,7 +393,7 @@ for my $test (
initial_values => {
name => '',
username => '',
- may_show_name => 1,
+ may_show_name => undef,
add_alert => 1,
photo1 => '',
photo2 => '',
@@ -496,7 +496,7 @@ for my $test (
initial_values => {
name => '',
username => '',
- may_show_name => 1,
+ may_show_name => undef,
add_alert => 1,
photo1 => '',
photo2 => '',
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index a9f9fb144..6750d3183 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -192,7 +192,7 @@ subtest 'check display of TfL reports' => sub {
$mech->follow_link_ok({ text_regex => qr/Back to all reports/i });
};
$mech->content_like(qr{<a title="TfL Test[^>]*www.example.org[^>]*><img[^>]*grey});
- $mech->content_like(qr{<a title="Test Test[^>]*bromley.example.org[^>]*><img[^>]*yellow});
+ $mech->content_like(qr{<a title="Test Test[^>]*href="/[^>]*><img[^>]*yellow});
};
subtest 'check geolocation overrides' => sub {
diff --git a/templates/web/base/admin/users/form.html b/templates/web/base/admin/users/form.html
index 7bc291419..ca3fd99fb 100644
--- a/templates/web/base/admin/users/form.html
+++ b/templates/web/base/admin/users/form.html
@@ -22,11 +22,11 @@
<input class="btn" type="submit" name="send_login_email" value="[% loc('Send login email') %]">
[% END %]
</li>
- <li><label class="inline" for="email_verified">[% loc('Email verified:') %]</label>
+ <li><label class="inline-text" for="email_verified">[% loc('Email verified:') %]</label>
<input type="checkbox" id="email_verified" name="email_verified" value="1" [% user.email_verified ? ' checked' : '' %]>
<li><label for="phone">[% loc('Phone:') %]</label>
<input type='text' class="form-control" id='phone' name='phone' value='[% user.phone | html %]'></li>
- <li><label class="inline" for="phone_verified">[% loc('Phone verified:') %]</label>
+ <li><label class="inline-text" for="phone_verified">[% loc('Phone verified:') %]</label>
<input type="checkbox" id="phone_verified" name="phone_verified" value="1" [% user.phone_verified ? ' checked' : '' %]>
[% IF username_in_abuse %]
diff --git a/templates/web/base/maps/pin.html b/templates/web/base/maps/pin.html
index e2d1c0021..3a3fb4cf0 100644
--- a/templates/web/base/maps/pin.html
+++ b/templates/web/base/maps/pin.html
@@ -1,6 +1,6 @@
[% DEFAULT pin_style = 'top:' _ (pin.py - 64) _ 'px; left:' _ (pin.px - 24) _ 'px; position: absolute;' -%]
[% IF pin.id %]
-<a title="[% pin.title | html %]" href="[% c.cobrand.base_url_for_report( pin.problem ) %][% pin.problem.url %]">
+<a title="[% pin.title | html %]" href="[% c.cobrand.relative_url_for_report( pin.problem ) %][% pin.problem.url %]">
[%- END -%]
<img border="0" src="[% start %][% c.cobrand.path_to_pin_icons _ 'pin-' _ pin.colour _ '.png' %]"
[% IF js -%]
diff --git a/templates/web/base/questionnaire/creator_fixed.html b/templates/web/base/questionnaire/creator_fixed.html
index 83037ee3d..754800bab 100644
--- a/templates/web/base/questionnaire/creator_fixed.html
+++ b/templates/web/base/questionnaire/creator_fixed.html
@@ -1,4 +1,4 @@
-[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Confirmation') %]
+[% INCLUDE 'header.html', bodyclass = 'authpage', title = loc('Confirmation') %]
<form method="post" action="/questionnaire/submit" id="questionnaire">
<input type="hidden" name="problem" value="[% problem_id | html %]">
@@ -9,14 +9,14 @@
[% loc("Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?") %]
</p>
-<p align="center">
-<input type="radio" name="reported" id="reported_yes" value="Yes"[% ' checked' IF reported == 'Yes' %]>
-<label class="inline" for="reported_yes">[% loc('Yes') %]</label>
-<input type="radio" name="reported" id="reported_no" value="No"[% ' checked' IF reported == 'No' %]>
-<label class="inline" for="reported_no">[% loc('No') %]</label>
+<p class="segmented-control segmented-control--radio">
+ <input type="radio" name="reported" id="reported_yes" value="Yes"[% ' checked' IF reported == 'Yes' %]>
+ <label class="btn" for="reported_yes">[% loc('Reported before') %]</label>
+ <input type="radio" name="reported" id="reported_no" value="No"[% ' checked' IF reported == 'No' %]>
+ <label class="btn" for="reported_no">[% loc('First time') %]</label>
</p>
-<p><input type="submit" class="btn" name="submit" value="[% loc('Submit') %]"></p>
+<p><input type="submit" class="btn btn--primary" name="submit" value="[% loc('Submit') %]"></p>
</form>
diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html
index 863b87817..200c690a6 100644
--- a/templates/web/base/report/_item.html
+++ b/templates/web/base/report/_item.html
@@ -30,7 +30,7 @@
<li class="item-list__item item-list--reports__item [% item_extra_class %]"
data-report-id="[% problem.id | html %]" data-lastupdate="[% problem.lastupdate %]" id="report-[% problem.id | html %]">
-<a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]">
+<a href="[% c.cobrand.relative_url_for_report( problem ) %][% problem.url %]">
[% IF problem.photo %]
<img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt="">
[% END %]
diff --git a/templates/web/base/report/_item_expandable.html b/templates/web/base/report/_item_expandable.html
index 6a4fe7191..27682012b 100644
--- a/templates/web/base/report/_item_expandable.html
+++ b/templates/web/base/report/_item_expandable.html
@@ -18,7 +18,7 @@
id="report-[% problem.id | html %]">
[% IF problem.photo %]
- <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]" class="item-list__item--expandable__hide-when-expanded">
+ <a href="[% c.cobrand.relative_url_for_report( problem ) %][% problem.url %]" class="item-list__item--expandable__hide-when-expanded">
<img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt="">
</a>
[% END %]
@@ -27,7 +27,7 @@
[% PROCESS 'report/_item_heading.html' %]
[% CATCH file %]
<h3>
- <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]">
+ <a href="[% c.cobrand.relative_url_for_report( problem ) %][% problem.url %]">
[% problem.title | html %]
</a>
</h3>
diff --git a/templates/web/base/report/_show_name_label.html b/templates/web/base/report/_show_name_label.html
index 1e62b5fc0..f57ba4295 100644
--- a/templates/web/base/report/_show_name_label.html
+++ b/templates/web/base/report/_show_name_label.html
@@ -1,4 +1,3 @@
-[%# if there is nothing in the name field then set check box as default on form %]
<div class="checkbox-group">
<input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF name_public %]>
<label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label>
diff --git a/templates/web/base/tokens/confirm_problem.html b/templates/web/base/tokens/confirm_problem.html
index f74517c8a..62053b1bc 100644
--- a/templates/web/base/tokens/confirm_problem.html
+++ b/templates/web/base/tokens/confirm_problem.html
@@ -2,7 +2,7 @@
<div class="confirmation-header">
- <h1><a href="[% c.cobrand.base_url_for_report( report ) %][% report.url %]">[% report.title %]</a></h1>
+ <h1><a href="[% c.cobrand.relative_url_for_report( report ) %][% report.url %]">[% report.title %]</a></h1>
[% IF c.cobrand.is_council %]
[% IF c.cobrand.owns_problem( report ) %]
@@ -21,7 +21,7 @@
<b>[% report.body %]</b>
</p>
<p>
- You can follow this problem on <a href="[% c.cobrand.base_url_for_report( report ) %][% report.url %]">FixMyStreet.com</a>.
+ You can follow this problem on <a href="[% c.cobrand.relative_url_for_report( report ) %][% report.url %]">FixMyStreet.com</a>.
</p>
[% END %]
diff --git a/templates/web/base/user/_anonymity.html b/templates/web/base/user/_anonymity.html
index cc3630f16..ee8882dd8 100644
--- a/templates/web/base/user/_anonymity.html
+++ b/templates/web/base/user/_anonymity.html
@@ -1,9 +1,9 @@
[%
- IF c.cobrand.default_show_name AND anonymous=='';
+ IF anonymous=='';
IF c.user_exists;
SET name_public = NOT c.user.latest_anonymity;
ELSE;
- SET name_public = 1;
+ SET name_public = c.cobrand.default_show_name;
END;
ELSE;
SET name_public = anonymous==0;
diff --git a/templates/web/bathnes/report/_show_name_label.html b/templates/web/bathnes/report/_show_name_label.html
index 8e58f816a..20f28f099 100644
--- a/templates/web/bathnes/report/_show_name_label.html
+++ b/templates/web/bathnes/report/_show_name_label.html
@@ -1,4 +1,3 @@
-[%# if there is nothing in the name field then set check box as default on form %]
<div class="checkbox-group">
<input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF name_public %]>
<label class="inline" for="form_may_show_name">Tick here to show my name publicly</label>
diff --git a/templates/web/zurich/tokens/confirm_problem.html b/templates/web/zurich/tokens/confirm_problem.html
index d2025f124..52376adce 100644
--- a/templates/web/zurich/tokens/confirm_problem.html
+++ b/templates/web/zurich/tokens/confirm_problem.html
@@ -6,7 +6,7 @@
loc('You have successfully confirmed your email address.');
tprintf(
loc( 'You can <a href="%s%s">view the problem on this site</a>.' ),
- c.cobrand.base_url_for_report( report ),
+ c.cobrand.relative_url_for_report( report ),
report.url
);
%]
diff --git a/web/cobrands/bathnes/js.js b/web/cobrands/bathnes/js.js
index a478d71fc..418e0650c 100644
--- a/web/cobrands/bathnes/js.js
+++ b/web/cobrands/bathnes/js.js
@@ -4,37 +4,11 @@ if (!fixmystreet.maps) {
return;
}
-fixmystreet.roadworks.display_message = function(feature) {
- var attr = feature.attributes,
- start = new Date(attr.start.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
- end = new Date(attr.end.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
- tooltip = attr.tooltip.replace(/\\n/g, '\n'),
- desc = attr.works_desc.replace(/\\n/g, '\n');
-
- var $msg = $('<div class="js-roadworks-message box-warning"><h3>Roadworks are scheduled near this location, so you may not need to report your issue.</h3></div>');
- var $dl = $("<dl></dl>").appendTo($msg);
- $dl.append("<dt>Dates:</dt>");
- $dl.append($("<dd></dd>").text(start + " until " + end));
- $dl.append("<dt>Summary:</dt>");
- var $summary = $("<dd></dd>").appendTo($dl);
- tooltip.split("\n").forEach(function(para) {
- if (para.match(/^(\d{2}\s+\w{3}\s+(\d{2}:\d{2}\s+)?\d{4}( - )?){2}/)) {
- // skip showing the date again
- return;
- }
- if (para.match(/^delays/)) {
- // skip showing traffic delay information
- return;
- }
- $summary.append(para).append("<br />");
- });
- if (desc) {
- $dl.append("<dt>Description:</dt>");
- $dl.append($("<dd></dd>").text(desc));
- }
- $dl.append($("<p>If you think this issue needs immediate attention you can continue your report below</p>"));
-
- $('.change_location').after($msg);
+fixmystreet.roadworks.config = {
+ tag_top: 'h3',
+ colon: true,
+ skip_delays: true,
+ text_after: "<p>If you think this issue needs immediate attention you can continue your report below</p>"
};
fixmystreet.roadworks.filter = function(feature) {
@@ -52,7 +26,7 @@ fixmystreet.roadworks.filter = function(feature) {
fixmystreet.roadworks.category_change = function() {
if (fixmystreet.map) {
- fixmystreet.roadworks.show_nearby(null, fixmystreet.map.getCenter());
+ fixmystreet.roadworks.show_nearby(null, fixmystreet.get_lonlat_from_dom());
}
};
diff --git a/web/cobrands/fixmystreet-uk-councils/roadworks.js b/web/cobrands/fixmystreet-uk-councils/roadworks.js
index 354dfaf77..57941082f 100644
--- a/web/cobrands/fixmystreet-uk-councils/roadworks.js
+++ b/web/cobrands/fixmystreet-uk-councils/roadworks.js
@@ -170,25 +170,57 @@ fixmystreet.roadworks.show_nearby = function(evt, lonlat) {
// The click wasn't directly over a road, try and find one nearby
feature = layer.getNearestFeature(point, 100);
}
- if (feature !== null && fixmystreet.roadworks.filter(feature)) {
- fixmystreet.roadworks.display_message(feature);
- return true;
+ if (feature !== null) {
+ if (!fixmystreet.roadworks.filter || fixmystreet.roadworks.filter(feature)) {
+ fixmystreet.roadworks.display_message(feature);
+ return true;
+ }
}
}
};
-fixmystreet.roadworks.filter = function() {
- return 1;
-};
+fixmystreet.roadworks.config = {};
fixmystreet.roadworks.display_message = function(feature) {
var attr = feature.attributes,
- start = attr.start.replace(/{ts '([^ ]*).*/, '$1'),
- end = attr.end.replace(/{ts '([^ ]*).*/, '$1'),
- tooltip = attr.tooltip.replace(/\\n/g, '\n');
- $('.change_location').after('<div class="js-roadworks-message box-warning">Roadworks are scheduled near this location from ' + start + ' to ' + end + ', so you may not need to report your issue: “' + tooltip + '”</div>');
+ start = new Date(attr.start.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
+ end = new Date(attr.end.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
+ tooltip = attr.tooltip.replace(/\\n/g, '\n'),
+ desc = attr.works_desc.replace(/\\n/g, '\n');
+
+ var config = this.config,
+ tag_top = config.tag_top || 'p',
+ colon = config.colon ? ':' : '';
+
+ var $msg = $('<div class="js-roadworks-message box-warning"><' + tag_top + '>Roadworks are scheduled near this location, so you may not need to report your issue.</' + tag_top + '></div>');
+ var $dl = $("<dl></dl>").appendTo($msg);
+ $dl.append("<dt>Dates" + colon + "</dt>");
+ $dl.append($("<dd></dd>").text(start + " until " + end));
+ $dl.append("<dt>Summary" + colon + "</dt>");
+ var $summary = $("<dd></dd>").appendTo($dl);
+ tooltip.split("\n").forEach(function(para) {
+ if (para.match(/^(\d{2}\s+\w{3}\s+(\d{2}:\d{2}\s+)?\d{4}( - )?){2}/)) {
+ // skip showing the date again
+ return;
+ }
+ if (config.skip_delays && para.match(/^delays/)) {
+ // skip showing traffic delay information
+ return;
+ }
+ $summary.append(para).append("<br />");
+ });
+ if (desc) {
+ $dl.append("<dt>Description" + colon + "</dt>");
+ $dl.append($("<dd></dd>").text(desc));
+ }
+ if (config.text_after) {
+ $dl.append(config.text_after);
+ }
+
+ $('.change_location').after($msg);
};
+
$(fixmystreet).on('maps:update_pin', fixmystreet.roadworks.show_nearby);
/* Stop sending a needless header so that no preflight CORS request */
diff --git a/web/cobrands/lincolnshire/roadworks.js b/web/cobrands/lincolnshire/roadworks.js
index a9fa64bb6..7b42a12f2 100644
--- a/web/cobrands/lincolnshire/roadworks.js
+++ b/web/cobrands/lincolnshire/roadworks.js
@@ -4,34 +4,6 @@ if (!fixmystreet.maps) {
return;
}
-fixmystreet.roadworks.display_message = function(feature) {
- var attr = feature.attributes,
- start = new Date(attr.start.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
- end = new Date(attr.end.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
- tooltip = attr.tooltip.replace(/\\n/g, '\n'),
- desc = attr.works_desc.replace(/\\n/g, '\n');
-
- var $msg = $('<div class="js-roadworks-message box-warning"><p>Roadworks are scheduled near this location, so you may not need to report your issue.</p></div>');
- var $dl = $("<dl></dl>").appendTo($msg);
- $dl.append("<dt>Dates</dt>");
- $dl.append($("<dd></dd>").text(start + " until " + end));
- $dl.append("<dt>Summary</dt>");
- var $summary = $("<dd></dd>").appendTo($dl);
- tooltip.split("\n").forEach(function(para) {
- if (para.match(/^(\d{2}\s+\w{3}\s+(\d{2}:\d{2}\s+)?\d{4}( - )?){2}/)) {
- // skip showing the date again
- return;
- }
- $summary.append(para).append("<br />");
- });
- if (desc) {
- $dl.append("<dt>Description</dt>");
- $dl.append($("<dd></dd>").text(desc));
- }
-
- $('.change_location').after($msg);
-};
-
fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_future, {
http_options: { params: { organisation_id: '1070' } },
body: "Lincolnshire County Council"
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index ba4ecb732..2491c4c21 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -281,7 +281,7 @@ label{
&.inline {
display: inline;
- padding: flip(0 2em 0 1em, 0 1em 0 2em);
+ padding: flip(0 1em 0 5px, 0 5px 0 1em);
font-weight: normal;
}
diff --git a/web/cobrands/zurich/base.scss b/web/cobrands/zurich/base.scss
index e7d7cc7c1..741539e9d 100644
--- a/web/cobrands/zurich/base.scss
+++ b/web/cobrands/zurich/base.scss
@@ -200,25 +200,10 @@ h4.static-with-rule {
}
}
-.admin {
- label.inline {
- padding: 0;
- }
-
- input[type="checkbox"] + label.inline {
- margin-right: 0.2em;
- }
-
-}
table#admin_bodies tr.is-deleted {
background-color: transparent;
}
-.admin-label--inline {
- display: inline; // rather than block
- margin-right: 0.333em; // bit of space between this and the following input
-}
-
.ui-spinner input {
// stop jQuery UI spinner inputs from inheriting FMS input styles
padding: 1px;